the maximum length of FQDN is 255, but why the max length of srvname in sys.sysservers in sql server is 128?

KJIN 21 Reputation points
2021-04-22T14:12:08.607+00:00

the maximum length of FQDN is 255, but why the max length of srvname in sys.sysservers in sql server is 128?

SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
    2021-04-22T21:37:11.967+00:00

    Because 128 is the standard max length for an identifier in SQL Server.

    That this should not be a roadblock. While it is common that the name of a linked server agrees with the actual name of the data source, it does not have to be that way. The name of a linked server is really only alias. For instance, you can do this:

    EXEC sp_addlinkedserver 'MYSERVER', '', 'MSOLEDBSQL', 'Myserver.subdomain.domain.com'
    

1 additional answer

Sort by: Most helpful
  1. CarrinWu-MSFT 6,891 Reputation points
    2021-04-23T06:19:26.387+00:00

    Hi @KJIN ,

    Welcome to Microsoft Q&A!

    I assume that if you create a linked server, that means you have another SQL Server instance. Instance names for SQL Server are limited to 16 characters. If the name of linked server is more than 128, it will get an error. Please refer to this thread and this blog.

    Best regards,
    Carrin


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    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.