1     ALTER PROCEDURE [dbo].[Proc_Test_commit1] 
 2     @result int output, --成功 1; 失败 0
 3     @message nvarchar(20) output
 4 AS
 5 BEGIN
 6     SET NOCOUNT ON
 7      
 8 begin try 
 9       begin tran yy 
10         insert into Test_Commit (b) values (3)
11  
12         insert into Test_Commit (a,b) values (1,3)
13         set @result=1
14       commit tran yy            
15                   end try   
16 begin catch
17         set @message= ERROR_MESSAGE() 
18         set @result=0
19         rollback tran yy        
20         --insert into SYS_Proc_Message([Message]) values(ERROR_MESSAGE())
21         print ERROR_MESSAGE()
22 end catch 
23      
24     SET NOCOUNT OFF;  
25      
26      
27 END

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
  • 2021-12-08
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案