Mega Code Archive

 
Categories / MSSQL Tutorial / Constraints
 

Constraints

Constraints are used by SQL Server to enforce column data integrity. Both primary and foreign keys are forms of constraints. Other forms of constraints used for a column include: UNIQUE constraints enforce uniqueness within a table on non-primary key columns. DEFAULT constraints can be used when you do not know the value of a column in a row when it is first inserted into a table. CHECK constraints are used to define the data format and values allowed for a column.