.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Adding check to an existing table.

Posted By:Abhisek Panda       Posted Date: November 30, 2009    Points: 10    Category: SQL Query    URL: http://www.dotnetspark.com  

When a check constraint is added to an existing table, the check constraint can apply to either,
Existing data
To new data only

By default the check constraints applies to new data as well as existing data,


Adding to new data only:
ALTER TABLE  with no check ADD CONSTRAINTS CHECK(condition)

You will be careful when adding a constraint without checking the existing data, because this bypasses the controls

in Microsoft SQL Server 2000 that enforces the integrity rules for the table.


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend