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.
| Author |
Topic |
|
mahesh_bote
Constraint Violating Yak Guru
298 Posts |
Posted - 2006-08-21 : 05:46:56
|
| need one stored procedure.Using one procedure i want to know the columns that are associated with the primary key and the name of the primary key.The output should be as followsTable Name PK_Constraint Name ColumnsTABLE017 PK_TABLE009 COLUMN001TABLE017 FK_TABLE009 COLUMN002Mahesh |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-08-21 : 05:58:48
|
| [code]select kcu.Table_Name, kcu.Constraint_Name, kcu.Column_Name from information_schema.table_constraints tc join information_schema.key_column_usage kcuon tc.Constraint_Name = kcu.Constraint_Name and tc.Constraint_Type = 'PRIMARY KEY'[/code]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
mahesh_bote
Constraint Violating Yak Guru
298 Posts |
Posted - 2006-08-21 : 06:08:47
|
| Thank You very much HarshMahesh |
 |
|
|
|
|
|