'-' in sql server

  • Hi!

    thereΒ΄s a sql server named 'srv-dev'.

    IΒ΄ve to update certain tables in 'srv-dev' from my server but sql says that ther is a syntax error near '-'

    what can I do??

    thanks in advance.

  • Most probably you want to shows us the full statement as well as the full error, don't you? πŸ™‚

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • place [] around the server name.

    Avoid names like this in the first place πŸ™‚

    ---------------------------------------------------------------------

  • PaulB-TheOneAndOnly (4/14/2010)


    Most probably you want to shows us the full statement as well as the full error, don't you? πŸ™‚

    statement

    INSERT INTO srv-dev.labmger.dbo.analysis

    SELECT *

    FROM hades.labmger.dbo.analysis

    error

    Mens. 102, Level 15, State 1, Line 1

    Incorrect syntax near '-'.

    thanks!

  • posts crossed [-] see above

    ---------------------------------------------------------------------

  • solved thanks!

  • Though the brackets will correct that issue, I recommend not including special characters in server or database names (_ - etc)

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • whats wrong with etc in a server or database name?

    πŸ˜€

    ---------------------------------------------------------------------

  • george sibbald (4/21/2010)


    whats wrong with etc in a server or database name?

    πŸ˜€

    Thanks George. LOL

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CirquedeSQLeil (4/20/2010)


    Though the brackets will correct that issue, I recommend not including special characters in server or database names (_ - etc)

    ... or in table names, column names, procedure names etc. πŸ™‚

  • nigel. (4/22/2010)


    CirquedeSQLeil (4/20/2010)


    Though the brackets will correct that issue, I recommend not including special characters in server or database names (_ - etc)

    ... or in table names, column names, procedure names etc. πŸ™‚

    Agreed - keeping them out of procedure names is such a hard thing to do when Microsoft does it that way. Then again, MS uses them by default in DBNames too (that is easier to curb though due to a lower frequency).

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply