Tuesday, November 3, 2020

eTrace delete test

create table Rowcounter (
rowcountt int,
timestampcol datetime default current_timestamp);


create job

Batchdelete

declare @row as int
declare @ctr as int = 0
declare @subj as varchar(300)
select @row = count(tdid) from dxT_TDHeader
while @ctr <= @row
begin
delete top(50000) from dxt_TDItem where tdid in (select tdid from dxT_TDHeader)
insert into rowcounter(rowcountt) values(@@rowcount)
set @ctr = @ctr + 50000
end




select * from rowcounter;

No comments:

Post a Comment