@@ServerName Not Set
sp_Blitz® Result: @@ServerName Not Set
The @@ServerName refers to the local server that SQL Server is running on. This property is set during installation, but there are instances where @@ServerName may be NULL or may not be correct.
Running the following will show the current TSQL value for this property:
1 2 |
SELECT @@SERVERNAME; GO |
This part of our SQL Server sp_Blitz® script checks @@SERVERNAME to make sure it’s set.
To Fix the Problem
If the @@ServerName property is NULL, running the following will fix the issue- but only after you restart the SQL Server instance. Yep, fixing this requires an outage.
1 2 |
exec sp_addserver 'new_name', local; GO |
If the @@ServerName property is incorrect, run the following to correct the issue:
1 2 3 4 |
exec sp_dropserver 'old_name'; GO exec sp_addserver 'new_name', 'local'; GO |