Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_vupgrade_sysarticlecolumns

  No additional text.


Syntax
create procedure sys.sp_vupgrade_sysarticlecolumns
as
begin
    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)
    begin
        -- 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)
        begin
            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
            begin
        insert into dbo.sysarticlecolumns(artid, colid) values (@artid, @colid)
        if @@error <> 0 return 1
            end

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

end

 
Last revision 2008RTM
See also

  sp_vupgrade_publisherdb (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