Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sureshg03
Starting Member
1 Post |
Posted - 2010-11-23 : 09:28:25
|
Dear All,i have a few update statements as given belowUpdate ocry set Country='AN' Where name='x'Update ocry set Country='AS' Where name='y'Update ocry set Country='AT' Where name='z'Update ocry set Country='AF' Where name='a'I m running the above queries in my sql serverI just want to know, what will happen, if there is error in second linewill first line rollback or third, fourth line won't executePls HelpRegardsSuresh G |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-23 : 09:33:44
|
first won't roll back unless you have an open transaction. 3rd and 4th probably won't execute but maytrybegin trybegin tranUpdate ocry set Country='AN' Where name='x'Update ocry set Country='AS' Where name='y'Update ocry set Country='AT' Where name='z'Update ocry set Country='AF' Where name='a'commit tranend trybegin catchrollback transelect 'failed'end catch==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|