Sql-server – Cannot delete publication

replicationsql servertransactional-replication

When attempting to delete a publication, I am getting the error cannot drop publication 'XX' cannot drop article 'XX'.

The subscription has been deleted at the subscriber. Any ideas on how I can force the deletion of the publication so that it can be recreated? I can execute

exec sp_dropsubscription @publication = N'XX', @subscriber = N'all'

but this has no apparent effect.

Best Answer

sp_removedbreplication Database name works for me but sometimes when replication is really screwed up I have to remove all replication by using sp_removesrvreplication