SQL Server script to remove replication?

Craig picture Craig · Jun 29, 2011 · Viewed 40.5k times · Source

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?

Answer

Siva picture Siva · Jun 29, 2011

Which version of SQL Server you are using.

Try

sp_removedbreplication 'DB_PROD' 
go

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