Skip to content

Instantly share code, notes, and snippets.

@GuyHarwood
Last active August 29, 2015 14:20
Show Gist options
  • Save GuyHarwood/655de8f6aca09e0bcd35 to your computer and use it in GitHub Desktop.
Save GuyHarwood/655de8f6aca09e0bcd35 to your computer and use it in GitHub Desktop.
Kill Connections And Drop Database
ALTER DATABASE [dbName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
DROP DATABASE [dbName]
GO
DROP LOGIN <loginName>
GO
/**
to execute this from the command line add the following to a batch file...
@echo off
sqlcmd -i "dropdb.sql"
echo done
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment