sys.default_constraints
sys.check_constraints
sys.key_constraints (, )
sys.foreign_keys
sys.check_constraints to check constraints on columns that are invalid for validation constraints on tables. For instance:CONSTRAINT CK_NumeroUsadas_NumeroTotal CHECK (NumeroUsadas <= NumeroTotal AND NumeroTotal >= 0),
Search for text within a constraint:
1.) SELECT CONSTRAINT_NAME,CHECK_CLAUSE
FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS
WHERE CHECK_CLAUSE like '%NumeroTotal%' or CHECK_CLAUSE LIKE '%NumeroUsadas%'
2.) SELECT object_definition(OBJECT_ID(CONSTRAINT_NAME)),*
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE = 'CHECK'
AND object_definition(OBJECT_ID(CONSTRAINT_NAME)) like '%NumeroTotal%'
or object_definition(OBJECT_ID(CONSTRAINT_NAME)) LIKE '%NumeroUsadas%'
source
share