没有把所有错误都抓出来,有时候@@error抓不到错误号,所以出现你这样的问题。

解决方案 »

  1.   

    检查begin tran与ROLLBACK WORK
    commit work的对应关系是否一致。
      

  2.   

    你的代码有问题那么多begin tran而只有一个commit tran 晕~
      

  3.   

    http://expert.csdn.net/Expert/TopicView1.asp?id=1675986
      

  4.   

    建议:只在开头用一个begin tran,结尾用一个commit tran ,出错时用ROLLBACK并退出.
      

  5.   

    你不会用事务代码吧!
    要:begin tran ..commit tran
      

  6.   

    begin tran
    set nocount on
     if IF @@ERROR <> 0 goto QuitWithRollback
    ....
     if IF @@ERROR <> 0 goto QuitWithRollback
    ... if IF @@ERROR <> 0 goto QuitWithRollback
    commit transaction
    GOTO   EndSave              
    QuitWithRollback:
    IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION 
    EndSave:
    set nocount off
      

  7.   

    begin TRANSACTION 
    set nocount on
     if IF @@ERROR <> 0 goto QuitWithRollback
    ....
     if IF @@ERROR <> 0 goto QuitWithRollback
    ... if IF @@ERROR <> 0 goto QuitWithRollback
    commit transaction
    GOTO   EndSave              
    QuitWithRollback:
    IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION 
    EndSave:
    set nocount off