Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incorrect syntax near '-'

i am trying to run a query in another server and need to specify it in the select statement but the server name has got an '-' in it, like server-name. this is producing the error in the title. How can i fix it?

like image 220
medusa Avatar asked Jul 02 '10 10:07

medusa


1 Answers

Use square brackets [] around the servername:

select  * 
from    [server-name].[db-name].[schema-name].[table-name]
like image 181
Andomar Avatar answered Nov 10 '22 05:11

Andomar