Using Constraints
Constraints—including PRIMARY KEY
, FOREIGN KEY
, UNIQUE
, CHECK
, and DEFAULT
—are the primary method used to enforce data integrity. They are relatively easy to implement, and they constrain or limit the values that are allowed in SQL Server tables.
Get Microsoft® SQL Server 2012 Unleashed 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.