开发者

sql server check constraints

Am I missing something? When I get SSM开发者_高级运维S to script a check constraint for create it produces two statements,

ALTER TABLE mytable  WITH CHECK ADD  CONSTRAINT [CK_myconstraint] CHECK  (([Time]>='2011-05-15 20:33:00.000' AND [Time]<='2011-05-17 20:31:00.000'))
GO
ALTER TABLE mytable CHECK CONSTRAINT [CK_myconstraint]

My understanding is that the "with check" should check the constraint on existing data when the constraint is being made. If this is true, why is it then checking the constraint again?

Thanks


You are correct, you only need the first one.

Don't know why SSMS does this. I thought maybe this was some permutation of "Scripting" options under Tools..Options, but I don't see anything likely

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜