While we are deleting the records form a big table which have billion or million of records. Instead of deleting the records at one time we are deleting the records in batch.
Below is the script to delete the records in a batch.
|
-- Process
10,000 rows at a time SET ROWCOUNT
10000; BEGIN DELETE FROM Table_name WHERE condtion; BREAK; -- No more rows left to delete END SET ROWCOUNT 0; |