sql server中 创建数据表时说明怎么用代码写
比如说:创建一个表为student,包括name,id,说明为姓名,学号,怎样用sql写代码?...
比如说:创建一个表为student,包括name,id,说明为姓名,学号,怎样用sql写代码?
展开
3个回答
展开全部
create table student
(
id int not NULL,
name varchar(10) not null
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student', @level2type=N'COLUMN',@level2name=N'id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student', @level2type=N'COLUMN',@level2name=N'name'
GO
(
id int not NULL,
name varchar(10) not null
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student', @level2type=N'COLUMN',@level2name=N'id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student', @level2type=N'COLUMN',@level2name=N'name'
GO
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CREATE TABLE [dbo].[eFA_QA](
[QuestionID] [int] IDENTITY(1,1) NOT NULL,
[ApplicationID] [varchar](12) NOT NULL,
[Question] [nvarchar](500) NULL,
[Answer] [nvarchar](2000) NULL,
[Submitter] [varchar](10) NOT NULL,
[SubmitDate] [datetime] NOT NULL CONSTRAINT [DF_eacct_QA_SubmitDate] DEFAULT (getdate()),
[Answerer] [varchar](10) NULL,
[AnswerDate] [datetime] NULL,
[CCList] [nvarchar](500) NULL,
[IsActive] [tinyint] NOT NULL CONSTRAINT [DF_eFA_QA_IsActive] DEFAULT ((1)),
CONSTRAINT [PK_eFA_QA] PRIMARY KEY CLUSTERED
(
[QuestionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'1:有效,0:无效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'eFA_QA', @level2type=N'COLUMN',@level2name=N'IsActive'
--那段EXEC即是。从服务器名一直定义到字段名,及内容value
[QuestionID] [int] IDENTITY(1,1) NOT NULL,
[ApplicationID] [varchar](12) NOT NULL,
[Question] [nvarchar](500) NULL,
[Answer] [nvarchar](2000) NULL,
[Submitter] [varchar](10) NOT NULL,
[SubmitDate] [datetime] NOT NULL CONSTRAINT [DF_eacct_QA_SubmitDate] DEFAULT (getdate()),
[Answerer] [varchar](10) NULL,
[AnswerDate] [datetime] NULL,
[CCList] [nvarchar](500) NULL,
[IsActive] [tinyint] NOT NULL CONSTRAINT [DF_eFA_QA_IsActive] DEFAULT ((1)),
CONSTRAINT [PK_eFA_QA] PRIMARY KEY CLUSTERED
(
[QuestionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'1:有效,0:无效' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'eFA_QA', @level2type=N'COLUMN',@level2name=N'IsActive'
--那段EXEC即是。从服务器名一直定义到字段名,及内容value
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
肯定是没保存吧/
你在重新建一张表试试`
用t-sql语句在查询分析器里建一张表
use
pubs
go
create
table
table1
(
u_id
int
primary
key
identity(1,1),
u_name
varchar(20)
)
然后再退了进去看看
pubs库里还有没有表
你在重新建一张表试试`
用t-sql语句在查询分析器里建一张表
use
pubs
go
create
table
table1
(
u_id
int
primary
key
identity(1,1),
u_name
varchar(20)
)
然后再退了进去看看
pubs库里还有没有表
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询