If I have a table with huge amount of data...and If I do incremental delete instead "one time delte"..what's the benefit ?
Onetime delete
DELETE table_1
WHERE BID = @BID
AND CN = @CN
AND PD = @PD;
Incremental Delete
While (1=1)
Begin
DELETE TOP (100000) FROM table_1
WHERE BID = @BID
AND CN = @CN
AND PD = @PD;
If @@rowcount = 0 -- No row affected.
BREAK
ELSE
Continue
End
I got help from http://stackoverflow.com/questions/3883420/deleting-a-sql-server-table-takes-much-time