Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgetfiltercolumnlist

  No additional text.


Syntax
create procedure sys.sp_MSgetfiltercolumnlist(
@pubid                uniqueidentifier,
@column_list         nvarchar(max) OUTPUT,
@source_objid        int,
@guid_alias            sysname=NULL,
@include_logical_record_link_columns bit = 0
)
AS
begin
    declare @columns    varbinary(128)
    declare @setcolcnt    int
    declare @colcnt        int
    declare @colname    nvarchar(140)
    declare @colid        int
    declare @unqual_sourcename    sysname
    declare @qual_sourcename    nvarchar(140)
    declare @tablenick    int
    declare @include    bit
    declare @filtertype int

    if @include_logical_record_link_columns = 1
        select @filtertype = 2
    else
        select @filtertype = 1

    if @guid_alias is NULL
    begin
        select @unqual_sourcename=object_name(@source_objid)
        select @qual_sourcename = QUOTENAME(@unqual_sourcename)
        end
    else
        select @qual_sourcename = @guid_alias

    select @columns = columns, @tablenick = nickname from dbo.sysmergearticles where objid = @source_objid and pubid=@pubid
    select @column_list = ''
    select @setcolcnt    = 0
    select @colcnt = count(*) from sys.columns where object_id = @source_objid

    declare collist CURSOR LOCAL FAST_FORWARD FOR
           select name, column_id from sys.columns where object_id = @source_objid order by column_id ASC
        FOR READ ONLY

    open collist
    fetch collist into @colname, @colid

    while (@@fetch_status <> -1)
    begin
        set @include = 0

        if columnproperty(@source_objid, @colname , 'isrowguidcol') = 1
        begin
            set @include = 1
        end
        else
        begin
            if exists (select * from dbo.sysmergearticles
                where objid = @source_objid and pubid = @pubid and sys.fn_MSisfilteredcolumn(subset_filterclause, @colname, @source_objid) = 1 )
                set @include = 1
            else if exists (select * from dbo.sysmergesubsetfilters
                where art_nickname = @tablenick and pubid = @pubid and sys.fn_MSisfilteredcolumn(join_filterclause, @colname, @source_objid) = 1  and (filter_type & @filtertype) = @filtertype)
                set @include = 1
            else if exists (select * from dbo.sysmergesubsetfilters
                 where join_nickname = @tablenick and pubid = @pubid and sys.fn_MSisfilteredcolumn(join_filterclause, @colname, @source_objid) = 1  and (filter_type & @filtertype) = @filtertype)
                set @include = 1
        end

        if @include = 1
        begin
            select @colname = QUOTENAME(@colname) --previously we use rowguidcol to replace 'rowguid'
            if @column_list=''                      --which can cause problems and is not necessary.
                select @column_list = @qual_sourcename + '.' + @colname
            else
                select @column_list = @column_list + ', ' + @qual_sourcename + '.' + @colname
            select @setcolcnt = @setcolcnt + 1
        end
    fetch next from collist into @colname, @colid
    END

    close collist
    deallocate collist

    --if @setcolcnt = @colcnt
    --    select @column_list = ' * '

    return 0
end

 
Last revision 2008RTM
See also

  sp_MScreate_article_logical_record_views (Procedure)
sp_MSdrop_rlcore (Procedure)
sp_MSpublicationview (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash