Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSdrop_pub_tables

  No additional text.


Syntax
create procedure sys.sp_MSdrop_pub_tables
AS
    DECLARE @retcode int

    begin tran
    save TRAN sp_drop_central_pub_tables

    /* drop 'sysarticles' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name= N'sysarticles'
		AND	ObjectProperty(object_id('sysarticles'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE sysarticles
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

    /* drop 'sysschemaarticles' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'sysschemaarticles'
		AND	ObjectProperty(object_id('sysschemaarticles'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE sysschemaarticles
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

    /* drop 'sysextendedarticlesview' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'sysextendedarticlesview'
		AND	ObjectProperty(object_id('sysextendedarticlesview'), 'IsView') = 1
	)
    BEGIN
        DROP VIEW sysextendedarticlesview
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END


    /* drop 'syspublications' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'syspublications'
		AND	ObjectProperty(object_id('syspublications'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE syspublications
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

    /* drop 'syssubscriptions' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'syssubscriptions'
		AND	ObjectProperty(object_id('syssubscriptions'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE syssubscriptions
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

	-- 
    -- SyncTran
	-- 

    /* drop 'sysarticleupdates' */
    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'sysarticleupdates'
		AND	ObjectProperty(object_id('sysarticleupdates'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE sysarticleupdates
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'MSpub_identity_range'
		AND	ObjectProperty(object_id('MSpub_identity_range'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE MSpub_identity_range
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END

	-- 
    -- end SyncTran
	-- 

    IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'systranschemas'
		AND	ObjectProperty(object_id('systranschemas'), 'IsTable') = 1
	)
	and not exists(select * from sys.databases where db_id() = database_id and is_cdc_enabled = 1)
    BEGIN
        DROP TABLE dbo.systranschemas
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END
	IF EXISTS
	(
		SELECT	*
		FROM	sys.objects
		WHERE	name = N'sysarticlecolumns'
		AND	ObjectProperty(object_id('sysarticlecolumns'), 'IsTable') = 1
	)
    BEGIN
        DROP TABLE dbo.sysarticlecolumns
        IF @@ERROR <> 0
        BEGIN
            goto ERROR
        END
    END


   	
	-- 
    -- BEGIN Peer2Peer
	-- 
	-- Allow drop of tables if this database
	-- is not a subscriber database as well
	IF OBJECT_ID('MSreplication_subscriptions', 'U') IS NULL
	BEGIN
		EXEC @retcode = sys.sp_MSdrop_peertopeer_tables
		IF @@ERROR <> 0 or @retcode <> 0
		BEGIN
            goto ERROR
		END
	END
	
	EXEC @retcode = sys.sp_MSrepl_ddl_triggers @type='tran', @mode='drop'
	IF @@ERROR <> 0 or @retcode <> 0
	BEGIN
            goto ERROR
	END
    COMMIT TRAN
    return 0

ERROR:
    if @@trancount > 0
    begin
        ROLLBACK TRAN sp_drop_central_pub_tables
        commit tran
    end
    RETURN(1)

 
Last revision 2008RTM
See also

  sp_MSdrop_repltran (Procedure)
sp_MSpublishdb (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