My client wants me to rename the process SQL server computer name to match a new company standard. The server instance currently is the same as the current computer name. I have found the following script:
Code:
DECLARE @machinename sysname,
@servername sysname,
@instancename sysname
SELECT
@instancename =
CASE WHEN charindex('\', @@servername) = 0 THEN ''
ELSE SUBSTRING(@@servername, CHARINDEX('\', @@servername), (len(@@servername)+ 1) - CHARINDEX('\', @@servername))
END
SET @machinename = convert(nvarchar(100), serverproperty('machinename')) + @instancename;
EXEC sp_dropserver @@servername;
EXEC sp_addserver @machinename, 'local'
print 'renamed to ' + @machinename
[\code]
On my office system, my instance shows up as LOCAL. Renaming the computer was no issue. When I went to modify an ODBC connection, the new computer name was there.
My question is: am I required to rename my instance if the instance is the existing computer name and not LOCAL? Would not the existing instance be broadcast as being available?