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.
| 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 databaseUSE masterGO-- Declare local variablesDECLARE @serverproperty_servername varchar(100), @servername varchar(100)-- Get the value returned by the SERVERPROPERTY system functionSELECT @serverproperty_servername = CONVERT(varchar(100),SERVERPROPERTY('ServerName'))-- Get the value returned by @@SERVERNAME global variableSELECT @servername = CONVERT(varchar(100), @@SERVERNAME)-- Drop the server with incorrect nameEXEC sp_dropserver @server=@servername-- Add the correct server as a local serverEXEC 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... |
 |
|
|
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 !! |
 |
|
|
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 serververify the machine namecheck if select @@servername is the sameif not, then use sp_dropserver 'oldname' restart the services issue sp_addlinkedserver @server='newname',@local='local' restart the servicesi know this may be the same procedure but just to make sure you don't start in mid air...--------------------keeping it simple... |
 |
|
|
|
|
|