DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
 
 
SITE SEARCH SQLUSA.com VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
How to update 5 million home equity loan accounts?

The following Microsoft SQL Server Transact-SQL script demonstrates how to perform millions of updates, in batches of 1000 at a time, on home equity loan accounts without bringing the system to a halt:

use FirstFidelityMasterArchive;

use HomeEquityLoan;

 

set rowcount 1000

while exists( select 1 from Payment where Cleared = 0 )

begin

  update Payment set Cleared = 1 where Cleared = 0

 

  waitfor delay '000:00:01'

 

end

set rowcount 0

-- End of Home Equity Loan Star nightly processing cycle

 

Related article:

http://www.sqlusa.com/bestpractices/largeupdate/

 

Exam Prep 70-461
SQL 2016 DESIGN & PROGRAMMING
 
 
 
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE