Skip to content

Instantly share code, notes, and snippets.

@aristotle0x01
Created September 13, 2014 06:51
Show Gist options
  • Save aristotle0x01/0eebc4239b755e80c7d1 to your computer and use it in GitHub Desktop.
Save aristotle0x01/0eebc4239b755e80c7d1 to your computer and use it in GitHub Desktop.
T-SQL forcefully delete a database involved in replication
--you should substitute 'dbname' with the database name you want to drop
use master
go
exec sp_helpreplicationdb
exec sp_removedbreplication 'dbname'
ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE dbname SET MULTI_USER
DROP DATABASE dbname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment