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