Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 583
  • Last Modified:

Renaming a sql server

I installed SQL Server 2005 on a machine named "hardName" and then tested the install.   We then made a DNS alias so the machine could be referenced as "easyName."  I have corrected @@servername via
    a) select @@servername
    b) sp_dropserver oldName
    c) sp_addserver newName,local
    d) Bounce the server.
    e) select @@servername  

The question is, how can I correct serverproperty('servername') without changing the machine's physical name?  The system administrators want to reference the computer via "hardName" but the users prefer "easyName."

One of the reasons for this process was because an old machine "easyName" was up during the install and during the migration of databases from "easyName" to "hardName."  Now that the migration is complete, I want to finish renaming the database instance.
0
AikiRyu
Asked:
AikiRyu
  • 5
  • 3
1 Solution
 
BrandonGalderisiCommented:
except for clusters, serverproperty("servername") is the machines PHYSICAL COMPUTER NAME.


http://msdn.microsoft.com/en-us/library/ms174396.aspx

MachineName:
Windows computer name on which the server instance is running.
For a clustered instance, an instance of SQL Server running on a virtual server on Microsoft Cluster Service, it returns the name of the virtual server.
NULL = Input is not valid, or an error.
Base data type: nvarchar(128)
0
 
Serge FournierAnalyst ProgrammerCommented:
dfs name resolution work fine here for us:

sql.corp.stas.local is our sql

before that i was using an environnement variable to point to my sql server
0
 
AikiRyuAuthor Commented:
Brandon,
Is there any way to change what the SQL server sees as the physical machine name?  Is there a registry change that could be made?
Aiki
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
BrandonGalderisiCommented:
No.  That reads the computer name.  But your users don't need to see this so why bother?
0
 
AikiRyuAuthor Commented:
One of my colleagues had a problem setting up replication on the new server.  Apparently the rep install process reads both @@servername and serverproperty('servername').  As yet, these two don't match and the replication install fails.
0
 
BrandonGalderisiCommented:
Correct'ish.  The servername comes from srvname in sysservers.  It doesn't have to match, but the srvname has to be valid for replication (no . or - etc.).  That's where srvnetname comes in to play.  You can call the server something else (except "local") in sysservers other than the physical computer name.
0
 
BrandonGalderisiCommented:
@@servername pulls from sysservers where srvid=0.
0
 
AikiRyuAuthor Commented:
select @@servername                       -- Looks ok
select * from sysservers                     -- Looks ok
select serverproperty ('servername')  -- Does not give what I want
0
 
BrandonGalderisiCommented:
Then use @@Servername, which pulls from sysservers.  serverproperty('machinename') will return the physical machine name, that's it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now