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 |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-07-05 : 11:55:37
|
| Is it possible to delete records from multiple tables like following:delete from table1,table1,table3 where userid=75Please let me know, thank you very much for the information. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-07-05 : 12:01:51
|
| If you have the proper relationships in these tables established to your master "Users" table, and you have ON DELETE CASCADE enabled up on those relations, then simply deleting rows from the Users table will remove the related rows from all related tables.- Jeff |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-07-05 : 12:02:15
|
| Nope....closest relative you can get is a "cascade delete" or a "trigger" to kick in as a delete on table1 is done.search BOL or here for details |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-07-05 : 12:02:28
|
| Nope - you can only update a single table at a time.Put all the deletes in a transaction if you are worried about it being atomic.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|