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

Failed to execute the package or element. Build errors were encountered

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

Temporary enable and disable SSRS subscriptions