April 30, 2012

sp_lightweightmergemetadataretentioncleanup (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_lightweightmergemetadataretentioncleanup()

MetaData:

 create procedure sys.sp_lightweightmergemetadataretentioncleanup  
@num_rowtrack_rows int = 0 output
as
declare @delbatchsize int
declare @delcount int
declare @retcode smallint

-- security check
exec @retcode = sys.sp_MSreplcheck_subscribe
if @retcode <> 0 or @@error <> 0 return 1

set @delbatchsize= 5000
set @num_rowtrack_rows= 0

set @delcount= @delbatchsize
while @delcount = @delbatchsize
begin
delete top (@delbatchsize) from dbo.MSmerge_rowtrack
where 1=sys.fn_MSrowispastretention(tablenick, changed, getdate())

set @delcount= @@rowcount
set @num_rowtrack_rows= @num_rowtrack_rows + @delcount
end

set @delcount= @delbatchsize
while @delcount = @delbatchsize
begin
delete top (@delbatchsize) from dbo.MSmerge_metadataaction_request
where 1=sys.fn_MSrowispastretention(tablenick, changed, getdate())

set @delcount= @@rowcount
end

No comments:

Post a Comment

Total Pageviews