March 10, 2009 at 5:04 am
Hi All,
I have a table that takes more time to update large number of records(millions of records). Is there any way(script) that updates the same in batches(say 500 at a time), by which it takes less time and also performance is faster.
Thanks in advance.
Priya
Regards
Priya
March 10, 2009 at 5:51 am
yes, but you have to be able to identify what has not been changed.
it most likely will NOT be faster, but should avoid locking the entire table for the updates
something like this:
SET ROWCOUNT 500
WHILE 1=1
BEGIN
UPDATE dbo.myTable
SET SOMEVALUE = ???
WHERE MyField = My Condition
IF @@ROWCOUNT = 0
BREAK
END
SET ROWCOUNT 0
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply