Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 4 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. –  Qmal 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.