Home All Groups Group Topic Archive Search About

How to list the names of check constraint of a table and how to show it's content?

Author
3 Feb 2006 9:26 AM
Frank Lee
How to list the names of check constraint of a table?
How to show the content of a check constraint?

Thanks

---Frank, SQL2005

Author
3 Feb 2006 9:38 AM
Tibor Karaszi
This should give you a start:

SELECT * FROM sys.check_constraints


Show quote
"Frank Lee" <Reply@to.newsgroup> wrote in message news:O5k41PKKGHA.3944@tk2msftngp13.phx.gbl...
> How to list the names of check constraint of a table?
> How to show the content of a check constraint?
>
> Thanks
>
> ---Frank, SQL2005
>
>
Author
3 Feb 2006 9:47 AM
Razvan Socol
Hi, Frank

This also works in SQL 2000 (as well as SQL 2005):

SELECT CC.CONSTRAINT_NAME, CC.CHECK_CLAUSE
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC
INNER JOIN INFORMATION_SCHEMA.CHECK_CONSTRAINTS CC
ON TC.CONSTRAINT_NAME=CC.CONSTRAINT_NAME
WHERE TABLE_NAME='YourTable' AND CONSTRAINT_TYPE='CHECK'

Razvan

AddThis Social Bookmark Button