Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
SQL
begin try
		begin tran 
		    update table1 set col1=@col1 where col1=@col1 
		    insert into table2 (col1,col2,DTS) values (@col1,@col2,GETDATE())		    
		commit tran
//I think we retunr Return 1 
end try
begin catch
		rollback tran
// return -1
end catch	
but it getting return 2
Posted
Updated 18-Aug-15 1:47am
v2
Comments
ZurdoDev 18-Aug-15 8:30am    
Return 2? Find out where it is doing that. Is it a record count or is something returning that number.

What exactly is your question?

1 solution

"Would you tell me if we are using transection and modifying more then three table then how we will know that transection committed successfully or not"

If your code gets to the commit tran then it was successful.

If you are asking about the mods doing something specific then you would need to run checks that would raise and error if the update does not do what you expect.
 
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