Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSremovedbreplication_internal

  No additional text.


Syntax

/* Permission to sysadmin */
create  procedure sys.sp_MSremovedbreplication_internal
(
      @dbname     		sysname,
      @type		  	nvarchar(5) = 'both',	-- 'merge' or 'tran' or 'both' to cleanup.	
      @ignore_distributor	bit = 0,
      @from_backup          bit = 0
)
AS
    SET NOCOUNT ON

    /*
    ** Declarations.
    */

    DECLARE @retcode int
    DECLARE @proc nvarchar(255)
    DECLARE @restoreoverride int
    DECLARE @db_status sysname
	DECLARE @ErrorMessage NVARCHAR(4000)

    /*
    ** Initialization
    */

    /*
    ** Support override of replication remove on attach and restore
    */

    SELECT @restoreoverride = 0 -- assume normal remove behavior
    -- using instance specific XP
    EXECUTE @retcode = master.dbo.xp_instance_regread 'HKEY_LOCAL_MACHINE',
                                'SOFTWARE\Microsoft\MSSQLServer\Replication',
                                'RestoreOverride',
                                @param = @restoreoverride OUTPUT,
                                @no_output = 'no_output'

    IF ( @@error = 0 ) and ( @retcode = 0 )
    BEGIN
        -- ReplRestoreOverride = 1 = user elects to take no cleanup on restore or attach
        IF ( ISNULL( @restoreoverride, 0 ) = 1 )
            RETURN(0)
    END

    /*
    ** Parameter check
    ** @dbname
    */
    IF NOT EXISTS (SELECT * FROM master.dbo.sysdatabases WHERE
        name = @dbname collate database_default)
    BEGIN
        RAISERROR(15010, 16, -1, @dbname)
        RETURN(1)
    END

	SELECT @proc = quotename(@dbname) + '.sys.sp_MSremovedbreplication'		
	EXEC @retcode = @proc @type = @type, @ignore_distributor = @ignore_distributor, @from_backup = @from_backup
	

	-- clean the replication bit.
	exec @retcode  = sys.sp_MSrepl_clean_replication_bit @dbname=@dbname,@type=@type	


	--drop sysreplservers
	SELECT @proc = QUOTENAME(@dbname) + '.sys.sp_refreshreplsysservers'
	EXEC @retcode =  @proc 	
	
    return (0)

 
Last revision 2008RTM
See also

  sp_attach_single_file_db (Procedure)
sp_MSrestoredbreplication (Procedure)
sp_removedbreplication (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