In this blog, we’ll discuss about Integrity constraint in SQL Server.
Integrity constraint are rules implemented in the tables to guarantee the accuracy, completeness, or consistency of data in tables and keep safe the business logic of the schema design.Constraints are part of a database schema definition
In SQL, all the constraints are mainly grouped together in 4 major types, they are:
- Primary integrity : which can be done by using
- Referential integrity : which can be done by using
- Domain integrity : which can be done by using
- User Defined integrity : which can be done be using
Please click on each constraints for detail explanation.
To get the details (like Constraint_Type,Constraint_Name,Constraint_Keys, enable / disable etc. ) of all the constraint define in a table execute the system procedure with table name.
EXEC sp_helpconstraint ‘dbo.Employee1’
Few examples might not work properly in MS SQL version less than 2008 R2. Please share your valuable comments.