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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Deletion loop

Author  Topic 

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-10-12 : 12:55:37
Hi all,

I've got a deletion loop (the variables have already been declared), but does this delete 20k rows in the first loop, and 40k on each subsequent one, or just chunks of 20K?

Thanks,

Jim

SET @MINMSGID = @MINMSGID + 20000
WHILE @MINMSGID < @MAXMSGID
BEGIN
DELETE a
FROM DBSrvr2.Queues.dbo.outqueue2 a
WHERE MM = @MonthProcessing AND
YY = @YearProcessing AND
MsgID < @MINMSGID
SET @MINMSGID = @MINMSGID + 20000
END

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-12 : 12:57:40
20,000 each iteration
Go to Top of Page
   

- Advertisement -