Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSdrop_mergesystables

  No additional text.


Syntax
create procedure sys.sp_MSdrop_mergesystables
    @whattodrop smallint    -- 1=heavyweight, 2=lightweight, 3=both
as
    -- Parameter check
    if @whattodrop not in (1,2,3)
    begin
        RAISERROR (20007, 16, -1)
        return 1
    end

    begin tran
    save transaction sp_MSdrop_mergesystables

    if 3=@whattodrop
    begin
        -- Drop shared  system tables.

        if object_id('sysmergearticles', 'U') is not NULL
        begin
            drop table dbo.sysmergearticles
            if @@error<>0 goto Error
        end

        if object_id('sysmergepublications', 'U') is not NULL
        begin
            drop table dbo.sysmergepublications
            if @@error<>0 goto Error
        end

        if object_id('sysmergesubscriptions', 'U') is not NULL
        begin
            drop table dbo.sysmergesubscriptions
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_sessions', 'U') is not NULL
        begin
            drop table dbo.MSmerge_sessions
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_identity_range_allocations', 'U') is not NULL
        begin
            drop table dbo.MSmerge_identity_range_allocations
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_history', 'U') is not NULL
        begin
            drop table dbo.MSmerge_history
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_articlehistory', 'U') is not NULL
        begin
            drop table dbo.MSmerge_articlehistory
            if @@error<>0 goto Error
        end

        if object_id('MSrepl_errors', 'U') is not NULL
        begin
            drop table dbo.MSrepl_errors
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_replinfo', 'U') is not NULL
        begin
            drop table dbo.MSmerge_replinfo
            if @@error<>0 goto Error
        end

        if object_id('sysmergeschemaarticles', 'U') is not NULL
        begin
            drop table dbo.sysmergeschemaarticles
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_delete_conflicts', 'U') is not NULL
        begin
            drop table dbo.MSmerge_delete_conflicts
            if @@error <> 0 goto Error
        end

        if object_id('sp_MSremovedebuginfrastructure','P') is not null
        begin
            declare @retval int
            exec @retval= sys.sp_MSremovedebuginfrastructure
            if @@error <> 0 or @retval <> 0 goto Error
        end

        if object_id('sysmergeextendedarticlesview', 'V') is not NULL
        begin
            drop view dbo.sysmergeextendedarticlesview
            if @@error <> 0 goto Error
        end

        if object_id('sysmergepartitioninfoview', 'V') is not NULL
        begin
            drop view dbo.sysmergepartitioninfoview
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_metadataaction_request', 'U') is not NULL
        begin
            drop table dbo.MSmerge_metadataaction_request
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_supportability_settings', 'U') is not NULL
        begin
            drop table dbo.MSmerge_supportability_settings
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_log_files', 'U') is not NULL
        begin
            drop table dbo.MSmerge_log_files
            if @@error <> 0 goto Error
        end
    end

    if @whattodrop in (1,3)
    begin
        -- Drop heavyweight tables.

        if object_id('sysmergepartitioninfo', 'U') is not NULL
        begin
            drop table dbo.sysmergepartitioninfo
            if @@error<>0 goto Error
        end

        if object_id('sysmergepartitioninfoview', 'V') is not NULL
        begin
            drop view dbo.sysmergepartitioninfoview
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_contents', 'U') is not NULL
        begin
            drop table dbo.MSmerge_contents
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_identity_range ', 'U') is not NULL
        begin
            drop table dbo.MSmerge_identity_range
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_tombstone', 'U') is not NULL
        begin
            drop table dbo.MSmerge_tombstone
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_genhistory', 'U') is not NULL
        begin
            drop table dbo.MSmerge_genhistory
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_settingshistory', 'U') is not NULL
        begin
            drop table dbo.MSmerge_settingshistory
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_conflicts_info', 'U') is not NULL
        begin
            drop table dbo.MSmerge_conflicts_info
            if @@error<>0 goto Error
        end

        if object_id('sysmergeschemachange', 'U') is not NULL
        begin
            drop table dbo.sysmergeschemachange
            if @@error<>0 goto Error
        end

        if object_id('sysmergesubsetfilters', 'U') is not NULL
        begin
            drop table dbo.sysmergesubsetfilters
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_errorlineage', 'U') is not NULL
        begin
            drop table MSmerge_errorlineage
            if @@error<>0 goto Error
        end

        if object_id('MSrepl_identity_range', 'U') is not NULL
        begin
            drop table dbo.MSrepl_identity_range
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_altsyncpartners', 'U') is not NULL
        begin
            drop table dbo.MSmerge_altsyncpartners
            if @@error<>0 goto Error
        end

        if object_id('MSdynamicsnapshotjobs', 'U') is not NULL
        begin
            drop table dbo.MSdynamicsnapshotjobs
            if @@error<>0 goto Error
        end

        if object_id('MSdynamicsnapshotviews', 'U') is not NULL
        begin
            drop table dbo.MSdynamicsnapshotviews
            if @@error<>0 goto Error
        end

        if object_id('MSmerge_dynamic_snapshots', 'U') is not NULL
        begin
            drop table dbo.MSmerge_dynamic_snapshots
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_partition_groups', 'U') is not NULL
        begin
            drop table dbo.MSmerge_partition_groups
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_current_partition_mappings', 'U') is not NULL
        begin
            drop table dbo.MSmerge_current_partition_mappings
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_past_partition_mappings', 'U') is not NULL
        begin
            drop table dbo.MSmerge_past_partition_mappings
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_generation_partition_mappings', 'U') is not NULL
        begin
            drop table dbo.MSmerge_generation_partition_mappings
            if @@error <> 0 goto Error
        end

        if object_id('MSsnapshotdeliveryprogress', 'U') is not NULL
        begin
            drop table dbo.MSsnapshotdeliveryprogress
            if @@error <> 0 goto Error
        end

        if object_id('MSmerge_supportability_settings', 'U') is not NULL
        begin
            drop table dbo.MSmerge_supportability_settings
            if @@error <> 0 goto Error
     end

        if object_id('MSmerge_log_files', 'U') is not NULL
        begin
            drop table dbo.MSmerge_log_files
            if @@error <> 0 goto Error
        end
        if object_id('MSmerge_agent_parameters', 'U') is not NULL
        begin
            drop table dbo.MSmerge_agent_parameters
            if @@error <> 0 goto Error
        end
    end

    if @whattodrop in (2,3)
    begin
        -- Drop lightweight tables.

        if object_id('dbo.MSmerge_rowtrack', 'U') is not null
        begin
            drop table dbo.MSmerge_rowtrack
            if @@error <> 0 goto Error
        end

        if object_id('dbo.MSmerge_filteringcolumns_lightweight', 'U') is not null
        begin
            drop table dbo.MSmerge_filteringcolumns_lightweight
            if @@error <> 0 goto Error
        end

        if object_id('dbo.MSmerge_idrange', 'U') is not null
        begin
            drop table dbo.MSmerge_idrange
            if @@error <> 0 goto Error
        end
    end

    -- drop the upgrade table
    if object_id('MSmerge_upgrade_in_progress', 'U') is not NULL
    begin
        drop table dbo.MSmerge_upgrade_in_progress
        if @@ERROR <> 0 goto Error
    end


    commit transaction
    return 0
Error:
    RAISERROR (20007, 16, -1)
    ROLLBACK TRANSACTION sp_MSdrop_mergesystables
    COMMIT TRANSACTION
    return 1

 
Last revision 2008RTM
See also

  sp_dropmergepullsubscription (Procedure)
sp_dropmergesubscription (Procedure)
sp_mergesubscription_cleanup (Procedure)
sp_MScreate_mergesystables (Procedure)
sp_MSmergepublishdb (Procedure)
sp_MSremovedbreplication (Procedure)
sp_removesrvreplication (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