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 |
|
GoDaddy
Yak Posting Veteran
64 Posts |
Posted - 2009-02-11 : 10:29:50
|
| Let's say you have a Table A. Table B, C, D have a FK on table A. Is there a way to find out what are the rows in B, C, D that have a ref on A? in a scripts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-11 : 10:50:56
|
yup. just doselect B.*from BJOIN AON A.PK=B.FKselect C.*from CJOIN AON A.PK=C.FK... |
 |
|
|
GoDaddy
Yak Posting Veteran
64 Posts |
Posted - 2009-02-11 : 11:22:24
|
| thanks, but is there a more generic solutions? without knowing that B, C, D have a FK. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-11 : 11:24:32
|
| yup..it works whether or not there's fk relationship. what it does is brings all records from first table which has matching value in second table field |
 |
|
|
GoDaddy
Yak Posting Veteran
64 Posts |
Posted - 2009-02-11 : 13:16:26
|
| I was looking for a more generic solution, like inspecting the table schema or something. Without explicitly selecting from specific table |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-11 : 13:49:15
|
quote: Originally posted by GoDaddy I was looking for a more generic solution, like inspecting the table schema or something. Without explicitly selecting from specific table
No you can't. |
 |
|
|
|
|
|