Enforcing Integrity: Constraints (Declarative Data Integrity)

SQL Server uses Transact-SQL structures to enforce data integrity. You can create these structures during table creation or by altering the table definition after the creation of the table and even after data has been inserted into the table.

To enforce entity integrity, SQL Server uses PRIMARY KEY and UNIQUE constraints, UNIQUE indexes, and the IDENTITY property. UNIQUE indexes are covered in Chapter 6, "Optimizing Access to Data: Indexes."

Note

The IDENTITY function is used to create an IDENTITY field in a table created by using the SELECT INTO statement.

For domain integrity, SQL Server provides system-supplied and user-defined data types, CHECK constraints, DEFAULT definitions, ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.