January 8, 2007 at 5:26 pm
Hey all,
I am trying to search my DB for any primary and foreign key constraints and or relations for a specific tables. how would i find this out? im a noob, sorry.
Thanks
January 8, 2007 at 8:47 pm
You can probably query sysobjects where xtype is in the primary/foreign key constraints (check BOL for the code) and join against sysdepends.
Sorry, not near a SQL server right now or I'd test it and post it.
January 8, 2007 at 9:34 pm
hi
Try the sysconstraints table.
"Keep Trying"
January 8, 2007 at 10:45 pm
Hi duddy Just check the following query
and enjoy................
Select * from information_schema.table_constraints constraints2
Select * from information_schema.Constraint_Column_Usage
Select * from information_schema.referential_constraints fkeys
Select * from information_schema.table_constraints constraints2
Shashi Kant(MCA)
January 8, 2007 at 11:44 pm
try using sp_pkeys or sp_fkeys to get the primary and foreign key relationships.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply