How to reference a sql server with a slash (\) in its name?

Posted by Bill Paetzke on Stack Overflow See other posts from Stack Overflow or by Bill Paetzke
Published on 2010-03-30T23:04:49Z Indexed on 2010/03/30 23:13 UTC
Read the original article Hit count: 311

Givens:

  • One SQL Server is named: DevServerA
  • Another is named: DevServerB\2K5

Problem:

From DevServerA, how can I write a query that references DevServerB\2K5?

I tried a sample, dummy query (running it from DevServerA):

SELECT TOP 1 *  
FROM DevServerB\2K5.master.sys.tables

And I get the error:

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '\.'.

However, I know my syntax is almost correct, since the other way around works (running this query from DevServerB\2K5):

SELECT TOP 1 *  
FROM DevServerA.master.sys.tables

Please help me figure out how to reference DevServerB\2K5 from DevServerA. Thanks.

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about sql-server