SQL server name with hyphen

  • SQL server name with hyphen

    Posted by DSC Communities on August 26, 2019 at 11:18 am
    • Marilyn Hunter

      Member

      August 26, 2019 at 11:18 AM

      We are creating our new Azure SQL server for our upgrade to GP2018.Ā  Our server naming convention includes hyphens in the server name.Ā  I have always been told to stay away from special characters with SQL and GP but is there any reason the server name should not include hyphens?

      Thanks,
      Marilyn

      ——————————
      Marilyn Hunter
      BCforward
      Indianapolis IN
      ——————————

    • Kevin Droz

      Member

      August 26, 2019 at 3:15 PM

      No issues, we have used them since SQL 2008 and GP 2010. We are currently running 2018 R2

      ——————————
      Kevin
      ——————————
      ——————————————-

    • Jo deRuiter

      Member

      August 27, 2019 at 9:12 AM

      Hi

      The “Special Characters” usually refers to !@#$%^&*(){}][|/?<>, etc but hyphens are never an issue.

      ?

      ——————————

      ——————————
      ——————————————-

    • Tom Monfre

      Member

      August 27, 2019 at 9:46 AM

      We have hadĀ hyphens in our server names for quite a few years and haven’t had any issues.Ā  One thing to note is how you reference the server name when you have a query from a different SQL server.Ā  You have to wrap the server name in square brackets [] otherwise you will get an error in your SQL query.Ā  For example;
      select * from [SQL-SERVER].DATABASE.DBO.TABLE.

      ——————————
      Tom Monfre
      Batteries Plus Bulbs, LLC
      Hartland WI
      ——————————
      ——————————————-

    • Jeff Pfershy

      Member

      August 28, 2019 at 9:23 AM

      There may be one gotcha (from the voice of experience!). What we typically refer to as hyphens can either be an ‘En dash’ or an ‘Em dash’, and SQL recognizes them differently since they have different values behind the scenes.

      Some Microsoft products will automatically convert an En dash to an Em dash, such as in Word when you type a space then a letter after a dash.

      This could trip you up when the ‘other’ dash is used in a server name, database name, object name, etc.. I know because an Em dash caused all manner of heartache when administering a SharePoint SQL server with 40+ databases some time ago.

      An unambiguous alternative would be to use an underscore šŸ™‚

      ——————————
      Jeff Pfershy
      Sr Business Analyst
      BluJay Solutions Inc
      Holland MI
      ——————————
      ——————————————-

    • Marilyn Hunter

      Member

      August 28, 2019 at 1:16 PM

      Thank you so much for all the responses.Ā  I love being able to get a variety of opinions.Ā  I am giving all this info to our IT team.

      Marilyn

      ——————————
      Marilyn Hunter
      BCforward
      Indianapolis IN
      ——————————
      ——————————————-

    • Kerry Hataley

      Member

      August 28, 2019 at 1:33 PM

      Good Afternoon Marilyn,

      Sorry for being late to the game, but I was at Summit Austrialia speaking on Dynamics GP and all things SQL…

      There are specific rule as defined by Microsoft for naming conventions and requirements in SQL server.
      Specifically for Regular Identifiers. (Names fro entities, Stored Procs etc).
      When an identifier doesn’t comply with all the rules they must be delimited. Meaning in brackets [] or quotes “” depending on the t-sql circumstance.

      Now Dynamics GP does do handle some delimitation correctly, but most vendors and home made T-SQL is not correctly developed or written as delimited code.

      The rules are as follows:
      1. Beginning character must be Unicode Standard 3.2 (a-Z) for english
      2. Subsequent characters can include:

      • Letters as defined in the Unicode Standard 3.2.
      • Decimal numbers
      • The at sign (@), dollar sign ($), number sign (#), or underscore (_) are allowed
      • Cant be a T-SQL reserved word (ADD, BEGIN etc)

      You can reference this from Microsoft Docs:
      https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017

      So NO it is highly suggested that a HYPEN not be used.

      I did just notice that you are referring to the Server name and not the database name, if you have linked servers or other ODATA type connections this is also a consideration.
      ——————————
      Kerry Hataley
      CEO & President
      Nanook Software, Inc
      ——————————
      ——————————————-

    • Jeff Pfershy

      Member

      August 28, 2019 at 1:59 PM

      Thanks for going deep on this one. Your detailed response and the MS link you provided are great reference material!?

      ——————————
      Jeff Pfershy
      Sr Business Analyst
      BluJay Solutions Inc
      Holland MI
      ——————————
      ——————————————-

    DSC Communities replied 6 years ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘SQL server name with hyphen’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!