Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Server Name mis-match

Author  Topic 

Ex
Posting Yak Master

166 Posts

Posted - 2006-04-11 : 01:28:18
Hi all,


I am trying to change the SQL Server name So that @@SERVERNAME and SERVERPROPERTY('ServerName') have the same value.
The name of the server changed and having issues with replication and other services since.

Calling @@SERVERNAME still returns the name of the server before it got changed.

So i am wondering how do i get @@SERVERNAME to update?



I tried this

-- Use the Master database
USE master
GO

-- Declare local variables
DECLARE @serverproperty_servername varchar(100),
@servername varchar(100)

-- Get the value returned by the SERVERPROPERTY system function
SELECT @serverproperty_servername = CONVERT(varchar(100),
SERVERPROPERTY('ServerName'))

-- Get the value returned by @@SERVERNAME global variable
SELECT @servername = CONVERT(varchar(100), @@SERVERNAME)

-- Drop the server with incorrect name
EXEC sp_dropserver @server=@servername

-- Add the correct server as a local server
EXEC sp_addserver @server=@serverproperty_servername, @local='local'



Howerver it didn't work as expected any ideas?

------------------------------------------------------------------

sp2 for IE is FIREFOX !!

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-11 : 01:53:33
you need to restart the services after adding the new name

--------------------
keeping it simple...
Go to Top of Page

Ex
Posting Yak Master

166 Posts

Posted - 2006-04-11 : 02:16:50
didn't help Jen still have the same problem. Since posting i found this http://forums.devx.com/showthread.php?t=17973 (haven't tried it yet) but does that sound correct.

Note I am not doing the upgrade myself its offsite hence the reason i haven't tried it yet


------------------------------------------------------------------

sp2 for IE is FIREFOX !!
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-11 : 02:51:08
without having to pass the values in a parameter/variable...

restart your server
verify the machine name
check if select @@servername is the same
if not, then use sp_dropserver 'oldname'
restart the services
issue sp_addlinkedserver @server='newname',@local='local'
restart the services

i know this may be the same procedure but just to make sure you don't start in mid air...

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -