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.
http://
http://
Contributed by:
Rohit kakria
I am software developer
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=591
Click here to go on website
|