July 15, 2010 at 4:44 pm
I have 2 queries. 1st query updates some table and runs 2nd query. If for some reason, 2nd query fails, 1st query updates should not happen. How to accomplish this. Please Help. Regards.
July 15, 2010 at 5:14 pm
Read and implement the sample code listed in the following links.
BEGIN TRANSACTION ...http://technet.microsoft.com/en-us/library/ms188929.aspx
Within the TRY block
T-SQL block...http://technet.microsoft.com/en-us/library/ms175976(SQL.90).aspx
Within the CATCH block
ROLLBACK TRANSACTION ....http://technet.microsoft.com/en-us/library/ms181299.aspx
No error
COMMIT TRANSACTION .... http://technet.microsoft.com/en-us/library/ms190295.aspx
If you have additional questions after following / reading the references come back and post the problem following the recommended method as discussed in the first link in my signature block
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply