Sql updating large number of rows
I have read somewhere this can be achieved by dividing into small parts, but how can I divide the above query?
Can you break out the set portions in a previous select query so it doesn't have to compute that during the update?How can I perform the update while maintaining good performance?If you know which rows haven't been updated and you can exclude updated rows by using a simple predicate, the ROWCOUNT setting can help you divide your update into batches. ROWCOUNT causes SQL Server to stop processing the query after the specified number of rows is returned.Often in my job I have to create a procedure inside SQL Server that will process millions of data rows, save them into a temp table (staging table) and finally save them into a table (s) in a database(s).I am not looking into alternative solutions, like SSIS.
Search for sql updating large number of rows:
there is a very similar question: Performance Inserting and Updating Millions of rows into a table This question is also relevant: What is the fastest way to insert large numbers of rows?