SQL语句新建表,同时添加主键、索引、约束
SQL语句新建数据表主键,索引,约束
CREATE TABLE[dbo].[T_SendInsideMessageRec](
[SendInsideMID][uniqueidentifier]NOT NULL,
[ReceiveMobile][nvarchar](20) NULL,
[SendTime][datetime]NULL,
[Content][nvarchar](200) NULL,
[result][nvarchar](100) NULL,
[remark][nvarchar](100) NOT NULL,
CONSTRAINT[PK_T_SendInsideMessageRec]PRIMARY KEY NONCLUSTERED
(
[SendInsideMID]ASC
)WITH (PAD_INDEX =OFF, STATISTICS_NORECOMPUTE =OFF, IGNORE_DUP_KEY =OFF, ALLOW_ROW_LOCKS =ON, ALLOW_PAGE_LOCKS =ON) ON[PRIMARY] ) ON[PRIMARY]
GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_SendInsideMID]DEFAULT (newid()) FOR[SendInsideMID]
sql约束条件大于0GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_ReceiveMobile]DEFAULT ('') FOR[ReceiveMobile]
GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_SendTime]DEFAULT (getdate()) FOR[SendTime]
GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_Content]DEFAULT ('') FOR[Content]
GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_result]DEFAULT ('') FOR[result]
GO
ALTER TABLE[dbo].[T_SendInsideMessageRec]ADD CONSTRAINT[DF_T_SendInsideMessageRec_remark]DEFAULT ('') FOR[remark]
GO
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论