May 21, 2012

sp_MSmap_partitionid_to_generations (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_MSmap_partitionid_to_generations(int @partition_id)

MetaData:

 create procedure sys.sp_MSmap_partitionid_to_generations @partition_id int  
as

declare @retcode smallint

exec @retcode = sys.sp_MSrepl_PAL_rolecheck
if (@retcode <> 0) or (@@error <> 0)
return 1

if exists (select * from dbo.MSmerge_contents)
begin
insert into dbo.MSmerge_generation_partition_mappings (publication_number, partition_id,
generation, changecount)
select cpm.publication_number, cpm.partition_id, mc.generation, count(*)
from dbo.MSmerge_current_partition_mappings cpm join dbo.MSmerge_contents mc
on mc.tablenick = cpm.tablenick
and mc.rowguid = cpm.rowguid
and cpm.partition_id = @partition_id
group by cpm.publication_number, cpm.partition_id, mc.generation
end

insert into dbo.MSmerge_generation_partition_mappings (publication_number, partition_id,
generation, changecount)
select ppm.publication_number, ppm.partition_id, ppm.generation, count(*)
from dbo.MSmerge_past_partition_mappings ppm
where ppm.partition_id = @partition_id
group by ppm.publication_number, ppm.partition_id, ppm.generation

return 0

No comments:

Post a Comment

Total Pageviews