March 2001
Intermediate to advanced
640 pages
14h 9m
English
Constraints are defined during the CREATE TABLE or ALTER TABLE command. They are used to enforce data integrity and ensure that valid data is entered into the columns. Constraints can also ensure that integrity is maintained between tables. A column-level constraint applies to a single column, whereas a table-level constraint applies to multiple columns, even if it does not apply to every column. PRIMARY KEY, UNIQUE, FOREIGN KEY, DEFAULT, and CHECK are all examples of constraints. Both PRIMARY KEY and UNIQUE constraints are used to enforce uniqueness on columns. However, a UNIQUE constraint can allow NULLs.
Tip
If you need to know the constraints already on a table, you can use the stored procedure
sp_helpconstraint table_name ...Read now
Unlock full access