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 |
stroek
Starting Member
18 Posts |
Posted - 2008-08-11 : 07:22:14
|
Hello AllI can't find a solution for next problem.I want to loop through a select (ex: select ID from TableA)And delete records from an other table using de selected recordsdelete from TableB where relationID = TableA.IDregards |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-11 : 07:47:48
|
[code]delete Bfrom TableB B inner join TableA Aon B.relationID = A.ID[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
stroek
Starting Member
18 Posts |
Posted - 2008-08-11 : 07:59:18
|
tks,I had an other solution,Delete from TableB where relationID in (select ID from TableA) |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-08-11 : 10:02:59
|
Yes, that'll work but Khtan's way is quicker.-------------Charlie |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 10:08:29
|
If you want to remove a large number of records, you might want to delete the records in batches instead.Otherwise the LOG file will grow. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|