--call your second sp here
if @@error<> 0 
 --failed
esle
 --succeeded

解决方案 »

  1.   

    or you can add an OUTPUT parameter to your second sp to indicate success or failure, then check the value in the first sp
      

  2.   

    我做了例子:
    begin 
    ......
    exec p1
    .......
    exec p2
    .....
    exec p3
    end
    我怎样能让,p1,p2,p3 一起成功,否则一起失败
      

  3.   

    begin tran test(事务的名称)
    ......
    exec p1
    .......
    exec p2
    .....
    exec p3
    if @@error=0 
       commit test
    else rollback test
      

  4.   

    begin tran tt
    ......
    exec @p1RetrunValue=p1
    .......
    exec @p2RetrunValue=p2
    .....
    exec @p3RetrunValue=p3
    if @p1RetrunValue=0 and @p2RetrunValue=0 and @p3RetrunValue=0
       commit tt
    else rollback tt当然你的每个存储过程都要返回如:return @@Error