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 |
|
Behseini
Starting Member
1 Post |
Posted - 2011-04-07 : 15:50:26
|
Hi GuysCould you please let me know what SQL query I can run to get the parent of a specified table?I find this code which is providing a list of child tablesSELECT object_name(parent_object_id)As 'Childs List'FROM sys.foreign_keysWHERE object_name(referenced_object_id) ='Stores' How can I run a code like this to list parent of "Stores" table?Thanks |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-04-07 : 20:04:07
|
I think what you are asking for is how to find the referenced objects given a name of a table where there is a foreign key. If so, it is similar to what you already did as inSELECT object_name(referenced_object_id)As 'Parent List'FROM sys.foreign_keysWHERE object_name(parent_object_id) ='Stores' |
 |
|
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2011-04-11 : 08:44:26
|
| you can see the help for the STORES table ...you can see the table references there... |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2011-04-16 : 18:27:19
|
| You could also make use of this....http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143772Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|