Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check constraints

Status
Not open for further replies.

CRuser89

Programmer
May 18, 2005
79
US
Hello,

I am very new to sql server. I am getting some errors in an application that is pointing me to a constraint in sql server. Can you please tell me how to see or check the column/table constrainst in sql server? When I right click on a table and select properties, I only see Key, ID, Name, Datatype, Size, Nulls, and Default. I have gone through all the options but dont' see constraints anywhere.

Thanks,
Tracy
 
Try this:

Code:
USE your_database_name
select constid,[id],colid,status from sysconstraints

constid is a constraint id, id - table id, colid - column id, status - indicates a constraint status.

Possible status values (from Books Online):
1 = PRIMARY KEY constraint.
2 = UNIQUE KEY constraint.
3 = FOREIGN KEY constraint.
4 = CHECK constraint.
5 = DEFAULT constraint.
16 = Column-level constraint.
32 = Table-level constraint.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top