Problem with Hyphen in server name?

Hi all, My sql server has a hyphen in its name, and I've noticed I can't use a fully qualified reference, server.database.owner.table. Is this a known bug , what's the fix apart from renaming

This is standard version, not a beta.



Answer this question

Problem with Hyphen in server name?

  • nron

    Could it be something like :

    Select a.groupName from [DYFLIN-SQL].DyflinSqlDB.dbo.tblGroups as a


  • Joseph Wee

    Thanks a lot Jp, you've cracked it, that works perfectly, much appreciated.
  • Jose Fuentes

    Thanks for the reply Jens, unfortunately the brackets don't seem to solve it, I now get the following error when I run my code

    Select [DYFLIN-SQL].DyflinSQLDB.dbo.tblGroups.GroupName From tblGroups;

    Msg 4104, Level 16, State 1, Line 6

    The multi-part identifier "DYFLIN-SQL.DyflinSQLDB.dbo.tblGroups.GroupName" could not be bound.


  • orbit

    Try with

    set quoted_identifier off

    Select "DYFLIN-SQL".DyflinSQLDB.dbo.tblGroups.GroupName From tblGroups;

    GO

    Cheers,

    Sunny


  • JoyK

    Hi Meltdown,

    this is anugly things having a hyphen,or any other character in the server name, but putting brackets around that should solve the problem.

    [server].database.owner.table

    HTH, Jens Suessmeyer.


  • mandoman2

    Thanks for trying Sunny, that doesn't work, it returns the following error:

    Msg 258, Level 15, State 1, Line 5

    Cannot call methods on varchar

    ...although GroupName is of datatype nvarchar


  • Jim Sharkey

    You're welcome! ;)
  • Problem with Hyphen in server name?