I have cursor which either Update table or Add data if record don’t exist. My requirement is
OPEN CURSOR
Fetch Next
While @@fetch_status = 0
if (Record found) then
call update stored procedure
else
call Add stored procedure
Now, issue I am having is, both update/add stored procedure call multiple other stored procedures to do operation. If anything wrong with any other stored procedure, I need to rollback everything
I did try with Begin Transaction and checking if @@Error but it didn’t work.
Any help? I am using SQL Server 2008
1 Answer