May 14, 2012

sp_MSfilterclause (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_MSfilterclause(nvarchar @publication
, nvarchar @article)

MetaData:

   
create procedure sys.sp_MSfilterclause
@publication nvarchar(258), @article nvarchar(258)
as
-- Return a text column as multiple readtexts of maxcol length --
declare @pubid int, @artid int
select @pubid = pubid from syspublications where name = @publication
if (@pubid is null) begin
RAISERROR (15001, 11, -1, @publication)
return 1
end
select @artid = artid from sysarticles where name = @article and pubid = @pubid
if (@artid is null) begin
RAISERROR (15001, 11, -1, @article)
return 1
end

declare @val varbinary(16), @len int, @ii int, @chunk int
-- filter clause is in unicode, the length is a half of the number of bytes.
select @val = textptr(filter_clause), @len = datalength(filter_clause)/2 from sysarticles where artid = @artid and pubid = @pubid
select @ii = 0, @chunk = 255

-- Get all the rows of an maxcol size --
while @len > @chunk begin
readtext sysarticles.filter_clause @val @ii @chunk
select @ii = @ii + @chunk, @len = @len - @chunk
end

-- Get the last chunk --
if (@len > 0)
readtext sysarticles.filter_clause @val @ii @len
return 0

No comments:

Post a Comment

Total Pageviews