June 8, 2012

sp_showcolv (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_showcolv(varbinary @colv)

MetaData:

   
create procedure sys.sp_showcolv
@colv varbinary(2953)
as
set nocount on

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

declare @i smallint
set @i= 0
while (@i < DATALENGTH(@colv)/12)
begin
declare @colidx smallint
set @colidx= cast(substring(@colv, @i*12+2,1) as smallint)
set @colidx= @colidx*256 + cast(substring(@colv, @i*12+1,1) as smallint)

declare @replnick binary(6)
set @replnick= (select substring(@colv, @i*12+3, 6))

declare @version int
set @version= cast(substring(@colv, @i*12+12,1) as int)
set @version= @version*256 + cast(substring(@colv, @i*12+11,1) as int)
set @version= @version*256 + cast(substring(@colv, @i*12+10,1) as int)
set @version= @version*256 + cast(substring(@colv, @i*12+9,1) as int)

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

No comments:

Post a Comment

Total Pageviews