Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Beginner
Aug 24, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Take Advantage of CREATE TABLE Supported Constraints

You should always try to take advantage of the features in SQL Server to automatically maintain the integrity of data. The CREATE TABLE statement supports data integrity. You can specify table or column level constraint along with the CREATE TABLE statement. CHECK constraints ensure that column values are valid. DEFAULT and NOT NULL constraints avoid the problems caused by missing column values which may be present in the system due to application bugs. PRIMARY KEY and UNIQUE constraints enforce the uniqueness of rows. FOREIGN KEY constraints ensure that rows in dependent tables always have a matching master record. IDENTITY columns efficiently generate unique row identifiers. TIMESTAMP columns ensure efficient concurrency checking between multiple user updates.

By taking advantage of these CREATE TABLE options, you can make the data rules visible to all users of the database. These server enforced rules help avoid errors in the data that can arise from incomplete enforcement of integrity rules by the application.

Deepak Pant
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date