+ 4
How to use nested transaction by other sp
i have 3 stored procedure. SP 1 and 2 for entry data using by Insert statement. SP 3 like below . runner of SP1 and SP2. i need , when exec sp1 or exec sp2 is made a error both of them roll-backing. Begin transaction Execute usp_addproduct @name,@new Execute usp_addproductdetials @itemid,@color Commit transaction Catch if @@TRANCOUNT > 0 rollback
1 Answer
+ 1
i'm not sure i usually use trigger for these purposes 
but try to write it like this :
begin try
Begin transaction
		
			Execute usp_addproduct @name,@new
	 
			Execute usp_addproductdetials @itemid,@color
	
Commit transaction
end try
begin Catch
		if @@TRANCOUNT > 0 
		rollback transaction
end catch



