Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSFixPubColumnBitmaps

  No additional text.


Syntax
create procedure sys.sp_MSFixPubColumnBitmaps
        @pubid uniqueidentifier,
        @artid uniqueidentifier,
        @bm varbinary(128) = NULL output,
        @NeedSchemaChange int = NULL output
as
        declare @delcols_prev varbinary(128)
        declare @delcols_now varbinary(128)
        declare @deletedcols varbinary(128)
        declare @excluded_cols varbinary(128)
        declare @excluded_cols_previous varbinary(128)
        declare @excluded_col_count int
        declare @missing_cols varbinary(128)
        declare @missing_col_count int
        declare @retcode int
        declare @objid int

        declare @is_republisher bit


       -- If this proc is called by replication agent as part of applying the DDL on the
       -- subscriber then this must be a republisher scenario.
    -- check if this is a republisher.
    if exists (select pubid from dbo.sysmergearticles where artid=@artid and pubid<>@pubid and sys.fn_MSmerge_islocalpubid(pubid)=0)
        select @is_republisher=1
    else
        select @is_republisher=0

    select     @delcols_prev        = deleted_cols,
            @missing_cols     = missing_cols,
            @excluded_cols     = excluded_cols,
            @objid             = objid
    from dbo.sysmergearticles where pubid = @pubid and artid = @artid

    -- Find the deleted columns
    exec sys.sp_MSfillup_deleted_cols @objid, @delcols_now OUTPUT

    set @delcols_prev=isnull(@delcols_prev, 0x00)
    set @delcols_now=isnull(@delcols_now, 0x00)

    exec @retcode= sys.sp_MSBitmapXOr
        @bm1= @delcols_prev,
        @bm2= @delcols_now,
        @bmout= @deletedcols output

    set @excluded_cols_previous = @excluded_cols

    if @is_republisher <> 1
    -- This is the root publisher. Build the deleted columns bitmask
    -- from by looking at sys.columns
    begin
        -- Add deleted col to missing col
        exec @retcode= sys.sp_ORbitmap
                @inputbitmap1= @missing_cols,
                @inputbitmap2= @deletedcols,
                @resultbitmap3= @missing_cols output

        exec @retcode= sys.sp_firstonly_bitmap
                    @inputbitmap1= @excluded_cols,
                    @inputbitmap2= @deletedcols,
                    @resultbitmap3= @excluded_cols output
    end
    else
    begin
        -- This is a re-publisher. The schemachange sp_MSFixSubColumnBitmaps must have already
        -- updated the missing columns bitmask based on what it got from its publisher. Use that bitmask
        -- instead of looking at sys.columns since we are interested in the absolute col index based on
        -- root publisher and what sys.columns will give us is the index based on the republisher table schema.
            exec @retcode= sys.sp_firstonly_bitmap
                            @inputbitmap1= @excluded_cols,
                            @inputbitmap2= @missing_cols,
                            @resultbitmap3= @excluded_cols output
    end

    if @excluded_cols = @excluded_cols_previous
    set @NeedSchemaChange = 1

    exec @retcode= sys.sp_MSBitmapCount
                @bm1= @excluded_cols,
                @count= @excluded_col_count output

    exec @retcode= sys.sp_MSBitmapCount
                @bm1= @missing_cols,
                @count= @missing_col_count output

    update dbo.sysmergearticles
        set     deleted_cols        = @delcols_now,
            excluded_cols     = @excluded_cols,
            excluded_col_count= @excluded_col_count,
            missing_cols         = @missing_cols,
            missing_col_count     = @missing_col_count
    where pubid = @pubid and artid = @artid

    exec @retcode= sys.sp_ORbitmap
                    @inputbitmap1= @missing_cols,
                    @inputbitmap2= @excluded_cols,
                    @resultbitmap3= @bm output
    return (0)


 
Last revision 2008RTM
See also

  sp_MSdrop_rlcore (Procedure)
sp_MSmerge_altertable (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