Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




List All The Constraint of all tables of Database

With below query we may find out the constraints of every table. It is useful in case when we want to update, delete any constraint.
USE Northwind;
GO
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
Order by TableName
GO
Above query will list all tables with their constraints.
Share this article   |    Print    |    Article read by 3207 times
Author:
Rohit kakria
I am software developer
Related Articles:
Related Interview Questions: