Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Store Proc + Transaction + Errors + VP
Message
From
02/04/2005 22:02:22
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Store Proc + Transaction + Errors + VP
Miscellaneous
Thread ID:
01001066
Message ID:
01001066
Views:
64
Hi I have store procedure that calls another procedure . lets say proc1 call pro2. In my proc1 i have param @HasError that allows me to check for error in transaction.Currently I have no prob with transaction. but i have problem when i call it in VPP8+SP1. I try to execute it through SQL Analyzer it seems that is return correct value. My assumption is that my transaction was aborted when error occured in Pro2 .
  llError=.f.

   SQLEXEC(oConn.nConnHandle,"{CALL proc1(?@llError)}")
  *** if error occured the   llError is still .f. 
create procedure sp_proc1 
	@HasError bit out
as 
  begin trans

 -- Where ERROR1 is an int
 -- I call another procedure which in this case generate an error 
  exec proc1 
 -- Then i Store error on Error1
 ....
 .....

  if @ERROR1<>0
    begin
      set HasError =1
     ROLLBACK TRANSACTION
   end
  else
   begin
       set HasError =2
       COMMIT TRANSACITON
  end  
Roses are #FF0000 Violets are #0000FF all my base are belong to you
Next
Reply
Map
View

Click here to load this message in the networking platform