June 7, 2012

sp_repldeletequeuedtran (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_repldeletequeuedtran(nvarchar @publisher
, nvarchar @publisher_db
, nvarchar @publication
, nvarchar @tranid
, bigint @orderkeylow
, bigint @orderkeyhigh)

MetaData:

 create procedure sys.sp_repldeletequeuedtran   
(
@publisher sysname
,@publisher_db sysname
,@publication sysname
,@tranid sysname
,@orderkeylow bigint
,@orderkeyhigh bigint
)
as
begin
declare @retcode int
set nocount on
--
-- Security check
--
exec @retcode = sp_MSreplcheck_subscribe
if @@error != 0 or @retcode != 0
return 1
--
-- validate inputs
--
if (@tranid is null
or @orderkeylow is null or @orderkeylow = 0
or @orderkeyhigh is null or @orderkeyhigh = 0
or @orderkeyhigh < @orderkeylow)
return 1
--
-- begin local transaction
--
begin transaction sp_repldeletequeuedtran
save transaction sp_repldeletequeuedtran
--
-- delete rows from MSreplication_queue
--
delete dbo.MSreplication_queue with (rowlock)
where publisher = UPPER(@publisher)
and publisher_db = @publisher_db
and publication = @publication
and tranid = @tranid
and orderkey between @orderkeylow and @orderkeyhigh
if (@@error != 0)
goto Error
--
-- delete row from MSrepl_queuedtraninfo
--
delete dbo.MSrepl_queuedtraninfo with (rowlock)
where publisher = UPPER(@publisher)
and publisher_db = @publisher_db
and publication = @publication
and tranid = @tranid
if (@@error != 0)
goto Error
--
-- commit local transaction
--
commit transaction sp_repldeletequeuedtran
--
-- all done
--
return 0

Error:
rollback transaction sp_repldeletequeuedtran
commit transaction
return 1
end

No comments:

Post a Comment

Total Pageviews