Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSget_colinfo

  No additional text.


Syntax
create procedure sys.sp_MSget_colinfo
(
    @objid int
    ,@colid int
    ,@artid int
    ,@bGetTextImageInfo tinyint = 0 -- boolean for returning text/image info
    ,@colname sysname output
    ,@ccoltype nvarchar(300) = null output -- can contain schema name of type
    ,@publishertype tinyint=1        -- 1 = mssqlserver, 2 = heterogeneous
)
as
begin
    declare @isset        int
            ,@pubtypemssqlserver tinyint
            ,@pubtypeheterogenous tinyint

    select @pubtypemssqlserver = 1
            ,@pubtypeheterogenous = 2

    if (@publishertype not in (@pubtypemssqlserver, @pubtypeheterogenous))
    begin
        raiserror(21402, 16, 17, '@publishertype')
        return 1
    end

    if (@artid is not NULL)
    begin
        -- this code path for synctran procs
        exec @isset = sys.sp_isarticlecolbitset @colid, @artid, @publishertype
    end
    else
        -- this code path for synctran triggers
        select @isset = 1

    if @isset = 1
    begin
        if (@publishertype = @pubtypemssqlserver)
        begin
        select
            @colname = col.name,
            -- prefix schema name with type if CLR UDT
            @ccoltype= case when (typ.system_type_id=240) then quotename(schema_name(typ.schema_id)) + N'.' + quotename(typ.name) else typ.name end
        from
            sys.columns col,
            sys.types typ
        where
            col.object_id = @objid
            and col.column_id = @colid
            and (
                --for all non-UDT types, we must get the name of base (physical) type
                --so, find the row in the types table which matches the system_type of the column
                (typ.user_type_id=col.system_type_id)
                or
                --for all UDT types, we just need to get the name of the user type
                (typ.system_type_id=240 and
                typ.user_type_id=col.user_type_id)
            )
    end
    else
    begin
            select @colname = c.name, @ccoltype= t.name
            from IHsyscolumns c, sys.types t
            where c.id = @objid and c.colid = @colid and c.xtype = t.user_type_id
        end
        -- when checking replicated columns, text/image datatypes cannot be declared or used locally
        if (@bGetTextImageInfo = 0) and (@ccoltype in (N'text',N'ntext',N'image'))
            return 1
    end
    else
    begin
        select @colname = null, @ccoltype = null
        return 1
    end
    -- return
    return 0
end

 
Last revision 2008RTM
See also

  sp_MSmaketrancftproc (Procedure)
sp_MSscript_compensating_insert (Procedure)
sp_MSscript_insert_statement (Procedure)
sp_MSscript_pkvar_assignment (Procedure)
sp_MSscript_trigger_assignment (Procedure)
sp_MSscript_trigger_update_checks (Procedure)
sp_MSscript_trigger_variables (Procedure)
sp_MSscript_update_statement (Procedure)
sp_MSscript_where_clause (Procedure)
sp_replscriptuniquekeywhereclause (Procedure)
sp_script_insertforcftresolution (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