1
2 CREATE PROCEDURE sp_remove_xact
3 @commid int,
4 @count smallint,
5 @password varchar(30) = NULL
6 AS
7
8
9 if exists (select *
10 from sybsystemdb.dbo.spt_committab
11 where commid = @commid
12 and password = @password)
13 begin
14 /*
15 ** Decrement outnum by @count.
16 */
17 UPDATE sybsystemdb.dbo.spt_committab
18 SET outnum = outnum - @count, lastchange = GETDATE()
19 WHERE commid = @commid
20
21 /*
22 ** Delete the row if outnum < 1
23 */
24 DELETE sybsystemdb.dbo.spt_committab
25 WHERE commid = @commid
26 and outnum < 1
27
28 end
29 else
30 begin
31 /*
32 ** 17380, "Commit service xact id doesn't exist."
33 */
34 raiserror 17380
35 end
36
exec sp_procxmode 'sp_remove_xact', 'AnyMode'
go
Grant Execute on sp_remove_xact to public
go