Does SQL server hostname supports hypen?

abraham flores 271 Reputation points
2025-02-12T22:30:06.26+00:00

Hi,

I Am trying to install SQL server 2019, since the beggining I faced a lot of problems (to install SQL Server and to configure DBs on Mirroring)

A new error I got says something about the hostname, my hostname is something like: hostname-01. Is hypen supported on SQL?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,474 questions
0 comments No comments
{count} votes

Accepted answer
  1. Marcin Policht 35,440 Reputation points MVP
    2025-02-12T22:35:24.57+00:00

    As per https://learn.microsoft.com/en-us/sql/sql-server/install/instance-configuration?view=sql-server-ver16

    Be aware of the following information when you name an instance of SQL Server:

    • Instance names aren't case-sensitive.
    • Instance names can't start or end with an underscore (_).
    • Instance names can't contain the term "Default" or other reserved keywords. If a reserved keyword is used in an instance name, a Setup error occurs. For more information, see Reserved keywords (Transact-SQL).
    • If you specify MSSQLSERVER for the instance name, a default instance is created.
    • An installation of Microsoft SQL Server 2016 (13.x) Power Pivot for SharePoint is always installed as a named instance of "Power Pivot". You can't specify a different instance name for this feature role.
    • Instance names are limited to 16 characters.
    • The first character in the instance name must be a letter. Acceptable letters are the ones defined by the Unicode Standard 2.0. These letters include Latin characters a-z, A-Z, and letter characters from other languages.
    • Subsequent characters can be letters defined by the Unicode Standard 2.0, decimal numbers from Basic Latin or other national scripts, the dollar sign ($), or an underscore (_).
    • Embedded spaces or other special characters aren't allowed in instance names. The backslash (), comma (,), colon (:), semicolon (;), single quotation mark ('), ampersand (&), hyphen (-), and at sign (@) also aren't allowed. Only characters that are valid in the current Windows code page can be used in SQL Server instance names. If an unsupported Unicode character is used, a Setup error occurs.

    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. DBG 2,376 Reputation points
    2025-02-12T22:48:44.05+00:00

    Hi Abraham, I'm not sure if by "hostname" you were referring to the "instance" name, but if not, then I think a hyphen in server names are allowed in SQL, but you'll need to enclose the name in square brackets in your code to avoid any errors. Hope that helps...


  2. LiHongMSFT-4306 30,671 Reputation points
    2025-02-13T01:39:53.1133333+00:00

    Hi @abraham flores

    I Am trying to install SQL server 2019, since the beggining I faced a lot of problems (to install SQL Server and to configure DBs on Mirroring)

    If you are specifying instance name during SQL Server installation, it's not possible to add hyphens in instance name.

    It is suggested to use underscore (_) as an alternative.

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.