Updated Server Name

I ran across an issue where a server name had been changed, and SQL function to return the server name returned different values.

select @@SERVERNAME – Old Name
exec sp_helpserver – Old Name
select ServerProperty(‘ServerName’) – New name

Books Online lists the difference as:
‘The ServerName property provides the Windows server and instance name that together make up the unique server instance. @@SERVERNAME provides the currently configured local server name.’

So running sp_dropserver to remove the old instance name, sp_addserver to add the new name, and restarting the SQL service will result in all functions returning the same value.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: