Month: December 2017

  • SQL Server – List all the Constraints by Table or by Column Name

    List all Constraints of the Database: [sql]SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS OR SELECT OBJECT_NAME(object_id) AS ConstraintName, SCHEMA_NAME(schema_id) AS SchemaName, type_desc AS ConstraintType FROM sys.objects WHERE type_desc LIKE ‘%CONSTRAINT'[/sql] List Constraints¬† on table column: [sql] Select SysObjects.[Name] As [Contraint Name] ,Tab.[Name] as [Table Name],Col.[Name] As [Column Name] From SysObjects Inner Join (Select [Name],[ID] From SysObjects Where XType […]