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 |
|
acdacd
Yak Posting Veteran
63 Posts |
Posted - 2005-08-19 : 04:18:14
|
| Hi If I want to delete a record in TableA, and some other table ref to it, except the i have choose cascade constraint, i cannot delete it, Right?Then, I want to design a client application to tell use why they cannot delete it, eg other record exist.Any idea ? My First idea is that i can find out the table ref to TableA, then return to client code to tell which data must be removed first, how to find out the table ref to tableA?Thxbe a hardworking people!! |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-19 : 04:51:32
|
| Is this just for each specific case, or are you wanting to build a generic solution that will work by checking which Foreign keys are actually active on the table?Kristen |
 |
|
|
Hunglech
Starting Member
16 Posts |
Posted - 2005-08-19 : 04:56:21
|
| SELECT name FROM sysobjects WHERE id IN (SELECT fkeyid FROM sysforeignkeys WHERE rkeyid IN (SELECT id FROM sysobjects WHERE name = 'TableName')) |
 |
|
|
|
|
|