sql statement viewing table constraints

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicolask
    New Member
    • Mar 2013
    • 1

    sql statement viewing table constraints

    sql statement for viewing table constraints
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    You can use sys.objects and filter the results to match your table
    Code:
    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’ AND OBJECT_NAME(parent_object_id)=‘yourTableName’

    Comment

    Working...