Why does "use db" with a hyphen throw "Incorrect syntax near '-'" ?

I think this SQL Server x.x  oddity goes back to the old Sybase 4 days!

If you want to use a database name that's been dubbed something like 'paula-objects' and type out:

use paula-objects

then execute the request, you'll get the error message:  Incorrect syntax near '-'

just type this instead:

use [paula-objects]

when you execute the request, the syntax error will clear up!

Print | posted @ Thursday, July 31, 2008 9:26 AM

Comments on this entry:

No comments posted yet.

Your comment:

Title:
Name:
Email:
Website:
 
Italic Underline Blockquote Hyperlink
 
 
Please add 8 and 8 and type the answer here: