SELECT *
FROM iv00108_history;
DECLARE @ROWCOUNTER AS INT;
SET @ROWCOUNTER = 903843;
WHILE @ROWCOUNTER != 0
BEGIN
DELETE TOP (1000)
IV00108
OUTPUT DELETED.[ITEMNMBR], DELETED.[CURNCYID], DELETED.[PRCLEVEL], DELETED.[UOFM], DELETED.[TOQTY], DELETED.[FROMQTY], DELETED.[UOMPRICE], DELETED.[QTYBSUOM], DELETED.[DEX_ROW_TS] INTO IV00108_History
WHERE PRCLEVEL IN ('LIST');
SET