Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Where do the contraints live?

Author  Topic 

Antinsh
Starting Member

16 Posts

Posted - 2008-03-19 : 08:38:47
Can someone write for me an example query that would select all the constraints that are applied to specific table?

something like:

SELECT
FieldThatHasConstraint,
FieldTableName,
TableToWhitchThisFieldHasConstraint,
FieldOfTableToWhitchThisFieldHasConstraint
TypeOfConstraint
FROM
???
WHERE
TableThatIWantToSearchForConstraints='myTable'

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-19 : 08:42:34
Query INFORMATION_SCHEMA.TABLE_CONSTRAINTS and INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE view.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

hai
Yak Posting Veteran

84 Posts

Posted - 2008-03-19 : 08:43:42
look up sp_help in BOL.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-03-19 : 09:20:35
sp_helpconstraints,sp_pkeys,sp_fkeys etc..
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-03-19 : 10:05:18
I was gonna say Georgia

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -