0
I have a PERSON table in it that has the field A and B that form a UNIQUE
.
I rotate this select to return the name of the constraint
:
SELECT DISTINCT COL.CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS Tab, INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE Col
WHERE Col.Constraint_Name = Tab.Constraint_Name
AND Col.Table_Name = Tab.Table_Name
AND Col.Table_Name = 'PESSOA'
AND COL.COLUMN_NAME IN ('A','B')
AND Tab.CONSTRAINT_TYPE = 'UNIQUE'
The problem is that if there is a UNIQUE
individual for both fields is returned as well. How do pro select return only the constraint
associated with columns A and B?
Thanks, show, I need.
– Roknauta