question

PeterBishop-3345 avatar image
0 Votes"
PeterBishop-3345 asked TomPhillips-1744 commented

@@SERVERNAME returns hostname portion in lowercase

I have a newly-built SQL 2019 instance and when I run @@SERVERNAME, the response I get is:

hostname\INSTANCENAME

where:

  • hostname is in lowercase

  • INSTANCENAME is in uppercase

Any ideas why this might be happening? If the instance name was lowercase, I'd put it down to me typing it that way during installation.

The Windows %COMPUTERNAME% variable returns the value in UPPERCASE.

Thanks.



sql-server-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

server and instance names are not case-sensitive, so this really doesn't matter.

0 Votes 0 ·
Yufeishao-msft avatar image
0 Votes"
Yufeishao-msft answered PeterBishop-3345 commented

Hi @PeterBishop-3345,

This may be because %computername% returns uppercase, but not the real computer name
https://www.tenforums.com/general-support/158126-computername-returning-upper-case-name.html

you can try to find the real name using hostname or from the settings>system>about


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

Note: Please follow the steps in our [documentation][5] to enable e-mail notifications if you want to receive the related email notification for this thread.





· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hostname returned a lowercase format of the server's name, so that's where the error must have occurred.

Thanks for that.

0 Votes 0 ·
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

I don't know why that may be happening. What does SELECT serverproperty('ServerName') return?

Anyway, you can try this:

EXEC sp_dropserver 'lowercase\INSTANCE'
EXEC sp_addserver 'UPPERCASE\INSTANCE', 'local'

and then restart SQL Server.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.