Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete database and ignore complaints

Status
Not open for further replies.

hapax

Programmer
Nov 10, 2006
105
US
Is there a way to just delete a SQL Server database, without it complaining about foreign keys and such? Is there a command to just ignore any issues and just drop the database anyway?

I'm always running into this when I'm developing.
 
When you drop a database the only thing it'll do it complain if there are uses in the database.

You'll have to kill the user connections first, then delete the database.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2005 BI / SQL 2008 DBA / SQL 2008 DBD / SQL 2008 BI / MWSS 3.0: Configuration / MOSS 2007: Configuration)
MCITP (SQL 2005 DBA / SQL 2008 DBA / SQL 2005 DBD / SQL 2008 DBD / SQL 2005 BI / SQL 2008 BI)
MCM (SQL 2008)
MVP

My Blog
 
I suspect the OP is really talking about dropping a table (not a database). Dropping a DB doesn't complain about foreign keys, but dropping a table would.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Well, I usually just go through the GUI, and right-click, Delete Database.

But maybe SQL "DROP databasename" works without complaining about foreign keys? I'll have to try that next time, or maybe the sp mentioned earlier in this thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top