Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgetcolumnlist

  No additional text.


Syntax

create procedure sys.sp_MSgetcolumnlist(
@pubid                uniqueidentifier,
@column_list         nvarchar(max) OUTPUT,
@source_objid        int,
@guid_alias            sysname=NULL
)
AS
/*
** if it is not vertically partitioned, then get all columns
** else get the column list as given in columns of dbo.sysmergearticles
*/
declare @bitset        int
declare @columns    varbinary(128)
declare @setcolcnt    int
declare @colcnt        int
declare @colname    nvarchar(258)
declare @colid        int
declare @unqual_sourcename    sysname
declare @qual_sourcename    nvarchar(258)

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 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
    exec @bitset = sys.sp_MStestbit @columns, @colid
--    if @bitset<>0
    if @bitset<>0 or @columns is null or @columns = 0x00
    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 = ' * '

 
Last revision 2008RTM
See also

  sp_addmergefilter (Procedure)
sp_changemergearticle (Procedure)
sp_mergearticlecolumn (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