SQL Server script to remove replication


I have been asked to write a SQL script that can be run, which will stop replication and remove the subscriber/subscription.

Is this at all possible? Or do you have to use the GUI?

Best Solution

Which version of SQL Server you are using.


sp_removedbreplication 'DB_PROD' 

Related Read - How to cleanup Replication Bits - http://blogs.msdn.com/b/repltalk/archive/2010/11/17/how-to-cleanup-replication-bits.aspx

Google as well provides MSDN article in results

How to: Disable Publishing and Distribution (Replication Transact-SQL Programming) - http://msdn.microsoft.com/en-us/library/ms147921.aspx