Click here to Skip to main content
16,021,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
alter procedure bankprocedure
as
begin
begin try
update bank set name='sarika' where money=50000 and type='savings' 
update tblemployee set name='samala' where salary=50000 and gender='female'
commit transaction
end try

begin catch
rollback transaction
end catch
end



showing this error:

(1 row(s) affected)

(0 row(s) affected)
Msg 3903, Level 16, State 1, Procedure bankprocedure, Line 11
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Posted
Updated 7-Feb-15 6:53am
v2
Comments
PIEBALDconsult 7-Feb-15 12:53pm    
And there is no BEGIN TRANSACTION, so why are you confused?
In fact the CATCH is called because the COMMIT TRANSACTION fails for the same reason.
samtumma113 Reddy 7-Feb-15 23:41pm    
thank u.i for got to write begin transaction

1 solution

There is no BEGIN TRANSACTION to COMMIT or ROLLBACK...!!! Add BEGIN TRANSACTION before update query. This will solve your error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900