Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgetcolordinalfromcolname

  No additional text.


Syntax
-- @colname should not be quoted when the following procedure is called
create procedure sys.sp_MSgetcolordinalfromcolname @objid int, @sync_objid int, @colname sysname, @colordinal int OUTPUT  as

    declare @colid      int
    declare @objcolname sysname
    declare @iscomputed tinyint
    declare @xtype      int

    select @colid = min(cs.column_id) from sys.columns cs
        inner join sys.columns co on co.object_id=@objid and co.name = cs.name
    where cs.object_id = @sync_objid
    and co.is_computed=0 and co.user_type_id<>type_id('timestamp')

    select @objcolname = name from sys.columns where object_id = @sync_objid and column_id = @colid
    select @iscomputed=is_computed, @xtype = user_type_id from sys.columns where object_id = @objid and name = @colname
    set @colordinal = 1

    while (@objcolname is not null and @objcolname <> @colname)
    begin
        if (@iscomputed=1 OR type_name(@xtype)='timestamp')
            goto Next_Column

    Next_Column:
        -- now set up to repeat the loop with the next column
        select @colid = min (column_id) from sys.columns where object_id = @sync_objid and column_id > @colid

        set @objcolname = NULL
        if @colid is not null
        begin
            select @objcolname = name from sys.columns where object_id = @sync_objid and column_id = @colid
            select @iscomputed=is_computed, @xtype = user_type_id from sys.columns where object_id = @objid and name = @colname
        end

        set @colordinal = @colordinal + 1
    end

    return 0

 
Last revision 2008RTM
See also

  sp_MSdrop_rlrecon (Procedure)
sp_MSinsertbeforeimageclause (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