需自己加eg:
create procedure test
As
   begin tran
   insert ...
   if @@error<> 0  goto Err
   delete...
   if @@error<> 0  goto Err
   update..
   if @@error<> 0  goto Err
   commit
   return
Err:
   rollback

解决方案 »

  1.   

    create procedure YourProcedureName
    As
       begin transaction
       insert ...
       if @@error<> 0 or @@rowcount<=0  goto on_error
       delete...
       if @@error<> 0  goto on_error
       update..
       if @@error<> 0  goto on_error
       commit
       returnon_error:
       rollback
       return -1
      

  2.   

    以上方法我试过了,好像就是不可以的!因为Insert等并没有进行操作,所以即使出错后的@@ERROR仍然为0