WITH CHECK ADD CONSTRAINT followed by CHECK CONSTRAINT vs. ADD CONSTRAINT

后端 未结 7 1021
天涯浪人
天涯浪人 2020-12-02 06:06

I\'m looking at the AdventureWorks sample database for SQL Server 2008, and I see in their creation scripts that they tend to use the following:

ALTER TABLE          


        
7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 07:02

    WITH CHECK is indeed the default behaviour however it is good practice to include within your coding.

    The alternative behaviour is of course to use WITH NOCHECK, so it is good to explicitly define your intentions. This is often used when you are playing with/modifying/switching inline partitions.

提交回复
热议问题