Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

NO CHECK instead of CHECK on Primary Key Expand / Collapse
Author
Message
Posted Monday, September 30, 2002 6:40 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 20, 2009 7:49 AM
Points: 21, Visits: 19
I am using DMO to create tables and primary keys. When I profile the server, I see that the primary key is created with a CHECK constraint. This must be the default because I am not setting this in my code.

I would like to generate a line of code like this:

ALTER TABLE tablename WITH NOCHECK ADD CONSTRAINT and so on......

instead of

ALTER TABLE tablename WITH CHECK ADD CONSTRAINT and so on.....

I see that the key object has a "Checked" property which I set to false, but I am not sure where to put the line of code.

Thanks for your help.






Post #7111
Posted Saturday, October 12, 2002 8:12 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Tuesday, June 11, 2013 6:34 AM
Points: 6,463, Visits: 1,388
Sorry it took so long. The checked property only applies to foreign keys. Primary keys are represented as indexes even though they are also indexes - the index being the method by which the constraint is enforced.

Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLShare - Learn One New Thing Each Day
SQLAndy - My Professional Blog
Connect with me on LinkedIn
Follow me on Twitter
Post #42630
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse