Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mattt
Posting Yak Master
194 Posts |
Posted - 2011-09-13 : 06:04:46
|
| Hi,I'm trying to create an automated script that drops one of our databases. No big deal under normal circumstances, but this particular DB is usually configured to use replication, so it has publications and subscriptions attached to it. So just trying to "DROP" the database fails as long as it has active replication jobs.So as part of my script I need to make sure all the replication publications and subscriptions attached to the DB are deleted before it gets dropped. I see from the documentation that there are various system stored procedures meant to help with this process, but they need to be targeted at particular objects, rather than a batch delete.Is there any way I can just run through all the replication subscriptions and publications on this database and delete the lot in one go? Cheers,Matt |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-09-13 : 07:16:19
|
| From the publisher database:First execute sp_dropsubscriptionThen execute sp_droppublicationThen execute sp_removedvbreplication (not needed usually, and should be last, else you can orphan objects in the distribution db)See here |
 |
|
|
mattt
Posting Yak Master
194 Posts |
Posted - 2011-09-13 : 07:18:18
|
| That's great, thanks. |
 |
|
|
|
|
|