Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Delete

Status
Not open for further replies.

nkm

Programmer
May 27, 2001
45
US
Can we delete rows in batches from a table until all rows with the particular condition are deleted.

e.g.

Delete first 10 from <tab1> where ...

thanks


 
hello,

try using set rowcount...

set rowcount 10
while exists (select 1
from tableName
where ...)
begin
delete tableName
where ...
end
go


hope this helps,
q.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top