|
-
September 19th, 2004, 07:55 PM
#1
transaction in SQL Server
I want two update and one delete statements that should be executed together as one single transaction. Is the following syntax correct? Can the if statement be used within the transaction
begin tran
update table1 set f1 = "asfs"
if @@error <>0
goto rlbk
update table2 set f2 = "gfdg"
if @@error <>0
goto rlbk
delete from table1 where f3 = "asdf"
if @@error <>0
goto rlbk
commit tran
return
rlbk:
rollback tran
-
September 20th, 2004, 06:56 AM
#2
Re: transaction in SQL Server
Sorry for the delayed reply
yes there is no problem of using if
but replace " with '
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|