Home Microsoft SQL Server DigiMailing iRN Contact


  No additional text.

create procedure sys.sp_vupgrade_sysarticlecolumns
    set nocount on
    -- sysarticles.columns is no longer used in Yukon, but before
    -- we can drop the column, we need to transfer the article column
    -- data to sysarticlecolumns

    -- Truncate dbo.sysarticlecolumns before we start so the whole
    -- process can be restarted in case of a failure
    truncate table dbo.sysarticlecolumns

    declare @colbitmap  binary(32)
          , @artid      int
          , @objid      int
          , @colid      int

    -- Variables for emulating the old sp_isarticlecolbitset logic
    declare @word       tinyint
          , @mval       int
          , @mask       smallint

    -- For each logbased article in sysarticle, ...
    declare hlogbasedarticles cursor local fast_forward for
        select artid, objid, columns
          from dbo.sysarticles
         where type & 0x1 = 0x1
    if @@error <> 0 return 1
    open hlogbasedarticles
    if @@error <> 0 return 1
    fetch hlogbasedarticles into @artid, @objid, @colbitmap
    if @@error <> 0 return 1
    while (@@fetch_status <> -1)
        -- For each column in the article base object...

        declare harticlecolumns cursor local fast_forward for
            select column_id
              from sys.columns
             where object_id = @objid
        open harticlecolumns
        fetch harticlecolumns into @colid
        while (@@fetch_status <> -1)
            set @word = convert(tinyint, 16 - floor((@colid-1)/16))
            set @mval = power(2, (@colid-1) % 16 )
            set @mask = convert( smallint, convert( binary(2), substring( convert( nchar(2), convert( binary(4), @mval ) ), 2, 1 ) ) )

            if convert( binary(2), substring( convert( nchar(16),@colbitmap), @word, 1 ) ) & @mask = @mask
        insert into dbo.sysarticlecolumns(artid, colid) values (@artid, @colid)
        if @@error <> 0 return 1

            fetch harticlecolumns into @colid
        close harticlecolumns
        if @@error <> 0 return 1
        deallocate harticlecolumns
        if @@error <> 0 return 1
        fetch hlogbasedarticles into @artid, @objid, @colbitmap
    close hlogbasedarticles
    if @@error <> 0 return 1
    deallocate hlogbasedarticles
    if @@error <> 0 return 1


Last revision 2008RTM
See also

  sp_vupgrade_publisherdb (Procedure)


  Query a named instance
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
Zoekmachine optimalisatie
SQL Servers hidden objects
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
sIFR; de combinatie tussen HTML en Flash