Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have multiple databases created by POCO approach of website building and I want to delete those. However I get error.


sqlcmd -S .\SQLEXPRESS -q "drop database aspnet-ORData-20120910180110"


Msg 102, Level 15, State 1, Server MY-PC\SQLEXPRESS, Line 1
Incorrect syntax near '-'.
share|improve this question
up vote 5 down vote accepted

Try this:

sqlcmd -S .\SQLEXPRESS -q "drop database [aspnet-ORData-20120910180110]"

Note the square brackets around the database name. Without them the dashes ("-") are seen as tokens instead of part of the database name and the parser will want to do math. The command parser interprets anything inside square brackets as a literal.

share|improve this answer
Thanks. Worked great. – Stan Sep 28 '12 at 17:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.