Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSget_col_position

  No additional text.


Syntax
create procedure sys.sp_MSget_col_position (
    @objid int,
    @artid int,
    @key     sysname,
    @colpos  sysname = NULL output,
    @art_col int = NULL output,
    @get_num_col bit = 0,
    @num_col  int = NULL output,
    @this_col int = null output,
    @skipcomputedcol bit = 0
    ,@agent_id	int = NULL  	-- null @agent_id means this is executed at pub side,
    										-- pub queries sysarticlecolumns for article column partition,
    										-- sub uses MSsubscription_articlecolumns
)
as
BEGIN
    declare @colname      sysname
                ,@ccoltype     sysname
                ,@isset           int

    select @num_col = 0
    
    -- Use a cursor to walk through the columns
    
    declare #hCColid cursor local fast_forward for
        select column_id, name from sys.columns where object_id = @objid order by column_id asc
    open #hCColid
    fetch #hCColid into @this_col, @colname
    while (@@fetch_status <> -1)
    begin
        if @artid is NULL
        begin
            
            -- processing updating trigger generation on subscriber.
            -- all columns are to be processed
            
            select @isset = 1
        end
        else
        begin
            
            -- processing updating procedure generation on publisher.
            -- only replicated columns are to be processed
            
            exec @isset = sys.sp_isarticlecolbitset @this_col, @artid, 1, @agent_id
        end
        
        -- If this is a computed column check if we need to skip it
        
        if @isset = 1
        begin
            if (columnproperty( @objid, @colname, 'IsComputed' ) = 1 and @skipcomputedcol = 1)
                select @isset = 0
        end
        
        -- Check we have a name match
        
        if @isset = 1
        begin
            select @num_col = @num_col + 1
            -- If @get_num_col is 1, we just need the number of columns in the partition.
            if (@get_num_col != 1) and (@colname = @key)
            begin
                select @colpos = 'c' + convert(varchar(4), @this_col)
                        ,@art_col = @num_col
                break
            end
        end
        fetch #hCColid into @this_col, @colname
    end
    close #hCColid
    deallocate #hCColid
    return 0
END

 
Last revision 2008RTM
See also

  sp_MSarticle_synctran_commands (Procedure)
sp_MSgettrancftsrcrow (Procedure)
sp_MSmakeconflicttable (Procedure)
sp_MSscript_begintrig1 (Procedure)
sp_MSscript_pkvar_assignment (Procedure)
sp_MSscript_trigger_updates (Procedure)
sp_MSscript_trigger_version_updates (Procedure)
sp_MSscript_where_clause (Procedure)
sp_replscriptuniquekeywhereclause (Procedure)
sp_repltablehasnonpkuniquekey (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