June 8, 2012

sp_showlineage (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_showlineage(varbinary @lineage)

MetaData:

   
create procedure sys.sp_showlineage
@lineage varbinary(311)
as
set nocount on

declare @result table (position smallint, replnick binary(6), version int)

declare @i smallint
set @i= 0
while (@i < DATALENGTH(@lineage)/10)
begin
declare @replnick binary(6)
set @replnick= (select substring(@lineage, @i*10+1, 6))

declare @version int
set @version= cast(substring(@lineage, @i*10+10,1) as int)
set @version= @version*256 + cast(substring(@lineage, @i*10+9,1) as int)
set @version= @version*256 + cast(substring(@lineage, @i*10+8,1) as int)
set @version= @version*256 + cast(substring(@lineage, @i*10+7,1) as int)

insert into @result(position, replnick, version) select @i+1, @replnick, @version
set @i= @i+1
end
select * from @result order by position

No comments:

Post a Comment

Total Pageviews