解决方案 »

  1.   

    在外面加BEGIN TRANS , commit。
      

  2.   

    你这个存储过程 不是只有@intvalue等于0的时候才会创建表吗?
      

  3.   

    你才两个条件 用if ,else if  就好。搞这么另类。
      

  4.   

    goto 我们一般是从语句后面往前跳 时使用
      

  5.   

    是要这个效果?
    create proc proc_test_test(@intvalue int)
    as
    create table tb1(id int check( id in (4,5,6)))
    create table tb2 (id int)
    create table tb3(id int) Begin try
     Begin tran t
     if(@intvalue>0)
     Begin
    insert into tb1 select 1
    insert into tb3 select 1
    insert into tb2 select 1

    End
    else if (@intvalue<0)
    Begin

    insert into tb1 select 2
    insert into tb3 select 1
    insert into tb2 select 1
    End
    commit tran t
       select '成功'
      select * from tb1
      select * from tb2
      select * from tb3
      drop table tb2
      drop table tb1
      drop table tb3
     end try 
     begin catch
       select '失败'
      select * from tb1
      select * from tb2
      select * from tb3
      drop table tb2
      drop table tb1
      drop table tb3
     rollback tran t
     end catch
    return