Monday, 4 July 2011

How to find out constraints on table with column?

select
t_obj


.name as TABLE_NAME ,c_obj.name as CONSTRAINT_NAME ,col.name as COLUMN_NAME from sysobjects c_obj join sysobjects t_obj on c_obj.parent_obj = t_obj.id join sysconstraints con on c_obj.id = con.constid join
syscolumns col on t_obj.id = col.id and con.colid = col.colid where
c_obj
.xtype = 'D'

No comments:

Post a Comment