October 22, 2009 at 9:08 pm
How can I do commit in my update? I am updating table with a lot of records before it fails on me, I want to make sure at least updates some of the records. How can I do it?
Here is an update:
Update table1
SET ext_table1.Qty = table2.Qty
from view1
view
select top 1000000 from
INNER JOIN
table2 ON table1.KU = table3.KU
October 22, 2009 at 9:26 pm
Break your Update into smaller slices by including some kind of condition that you are aware (may be by using a Date Column and putting between Clause)
And also use
BEGIN TRANS TRANSACTIONNAME
and
COMMIT TRANS TRANSACTIONNAME
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
October 22, 2009 at 9:37 pm
You mean
Begin
Begin transaction
Update statment
Commit
End
How can I right code that I want every 100 records to commit?
October 22, 2009 at 9:53 pm
Krasavita (10/22/2009)
How can I right code that I want every 100 records to commit?
Try this
set rowcount 100
begin tran
update MYTABLE
set COL1 = 'COL1'
where COL1 = 'COL2'
after found no error then commit the above tran or otherwise rollback tran
October 22, 2009 at 10:08 pm
Thank you,but I wanted to commit 100 and then again 100. How can I write it.Thank you
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply