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 |
|
TiaBag
Starting Member
1 Post |
Posted - 2011-02-15 : 15:28:23
|
| Guys,wonder if someone could help.I am trying to delete items from multiple tables.From table A, I want to delete everything. This table contains a guid which is referenced other tables e.g. table B and C. These tables also include guids to identify them plus other guid references.How do I delete everything from Table A, delete those items from table B where my guid from table A is referenced. Table B also contains other guids which references a different tables. I need to delete these references also.Any ideas on how I would go about this task?thanks |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2011-02-16 : 06:28:25
|
| http://stackoverflow.com/questions/2788575/tsql-script-to-add-delete-cascade-to-existing-tablesCharlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2011-02-16 : 06:30:36
|
Or do it manually in reverse.DELETE bFROM tableB AS b JOIN tableA AS a ON a.[<yourColumn] = b.[yourColumn]DELETE cFROM tableC AS c JOIN tableA AS a ON a.[<yourColumn] = c.[yourColumn]DELETE aFROM tableA AS a Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
shamasm
Starting Member
11 Posts |
Posted - 2011-02-16 : 06:48:49
|
| You want to delete Table A alone or other two tables B and c also |
 |
|
|
|
|
|