Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Store Proc + Transaction + Errors + VP
Message
De
02/04/2005 22:02:22
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Store Proc + Transaction + Errors + VP
Divers
Thread ID:
01001066
Message ID:
01001066
Vues:
65
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform