title: How to complete this query to remove replication and then drop database?
body: <p>I'm trying to remove replication and drop database all in one query when selecting the database from right-click context menu and running custom script.</p>
  <p>I'm able to remove replication, but I get the error below when trying to drop database.</p>
  <p><a href="https://i.stack.imgur.com/rdHng.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rdHng.png" alt="error" /></a></p>
  <pre><code>DECLARE @DB varchar(50)
  SELECT @DB = DB_NAME()
  USE master
  EXEC sp_removedbreplication @DB
  GO
  DROP DATABASE @DB
  </code></pre>