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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql 7 - escaping characters 1

Status
Not open for further replies.
May 13, 2005
5
0
0
IT
I've got a db with special characters in the name (in this case a minus sign)
when I try to use it (with use db-name )

I got :

Server: Msg 170, Level 15, State 1, Line 1

Line 1: Incorrect syntax near '-'.

quoting the db-name doesn't seems to work.

any suggestion?

thanks in advance
 
have you tried placing [around the database-name] ???

the square brackets are used for this kinda stuff.

Not exactly sure but I am pretty sure this is what you need to do.

George Oakes
Check out this awsome .Net Resource!
 
I tried it and it worked, just in case you were talking about a table and not a database, I also put the - hyphen in the table name too. Here is the script...

Code:
use [db-name]
select * from [table-name]


George Oakes
Check out this awsome .Net Resource!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top