I use this ( this is home cooked)
create proc temp_slowDelete
(
@table varchar(255),
@where varchar(1024)
)
as
/* Slow transaction friendly delete */
declare @ParmDefinition nvarchar(1024)
declare @deleteStatment nvarchar(2048)
declare @statment nvarchar(2048)
declare @total int
declare @rowcount int
Select @deleteStatment = ''delete from '' + @table + '' where '' + @where
set rowcount 250000
set nocount on
RAISERROR (''Counting rows to delete...'',0,1) WITH NOWAIT
SET @ParmDefinition = N''@CountOUT int OUTPUT'';
select @statment=''select @CountOUT = count(*) from '' + @table + '' where '' + @where
exec sp_executesql @statment,@ParmDefinition,@CountOUT=@total OUTPUT;
if (@total = 0)
begin
print ''Nothing todo :)''
return
end
RAISERROR (''%d to delete'',0,1,@total) WITH NOWAIT
exec sp_executesql @deleteStatment
set @rowcount = @@ROWCOUNT
while (@ROWCOUNT > 0)
begin
select @total = @total - @ROWCOUNT
RAISERROR (''Deleted %d, %d left'',0,1,@rowcount,@total) WITH NOWAIT
exec sp_executesql @deleteStatment
set @rowcount = @@ROWCOUNT
end'