DECLARE @distributionDB AS sysname; DECLARE @publisher AS sysname; DECLARE @publicationDB as sysname; SET @distributionDB = N'distribution'; -- -- --Disable the publication database. --USE [SunmarOperatorProd] --EXEC sp_removedbreplication @publicationDB; --Remove the registration of the local Publisher at the Distributor. --USE master --EXEC sp_dropdistpublisher @publisher='MSK0-SQL-P0SU' -- Delete the distribution database. EXEC sp_dropdistributiondb @distributionDB; -- Remove the local server as a Distributor. EXEC sp_dropdistributor; GO --EXEC master.dbo.sp_serveroption @server=N'MSK0-SQL-P0SU', @optname=N'dist', @optvalue=N'true' --GO --EXEC sp_dropdistributor @no_checks = 1, @ignore_distributor = 1 --GO