Find all constraint information

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%'
--WHERE type_desc LIKE '%PRIMARY_KEY_CONSTRAINT%'
--WHERE type_desc LIKE '%FOREIGN_KEY_CONSTRAINT%'
--WHERE type_desc LIKE '%DEFAULT_CONSTRAINT%'
GO

Comments

Popular posts from this blog

Exception deserializing the package "The process cannot access the file because it is being used by another process."

SSRS INTERVIEW QUESTIONS

Temporary enable and disable SSRS subscriptions