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 |
|
js.reddy
Yak Posting Veteran
80 Posts |
Posted - 2009-07-01 : 07:07:36
|
| Hi Friends,I want to know the foreign key constraint name of particular table and a particular column.example:table name : mytablecolumn name : studentIDIn the above table, I want to know the name of foreign key constraint on the column 'studentID'.If there is no foreign key constraint on that column display 'null'RegardsJS.Reddy |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-01 : 07:10:41
|
| select object_name(constid)constraintname,object_name(id)tablename from sys.sysconstraints where object_name(id) ='mytable'or try sp_help 'tbl_Common_HelpFiles_TextDetails' |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-01 : 07:12:24
|
See INFORMATION_SCHEMA.KEY_COLUMN_USAGE N 56°04'39.26"E 12°55'05.63" |
 |
|
|
js.reddy
Yak Posting Veteran
80 Posts |
Posted - 2009-07-01 : 07:17:48
|
Thank you so much.quote: Originally posted by Peso See INFORMATION_SCHEMA.KEY_COLUMN_USAGE N 56°04'39.26"E 12°55'05.63"
|
 |
|
|
js.reddy
Yak Posting Veteran
80 Posts |
Posted - 2009-07-01 : 07:18:35
|
Thank you so much.quote: Originally posted by bklr select object_name(constid)constraintname,object_name(id)tablename from sys.sysconstraints where object_name(id) ='mytable'or try sp_help 'tbl_Common_HelpFiles_TextDetails'
|
 |
|
|
|
|
|