Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When i installed windows i had a typo in the machine name that i corrected from the system's 'Computer Name/Domain Changes' - the workstation is a member of a workgroup not a domain. From everything i can see the renamed machine name is correct.

Shift gears.... I'm importing SQL logins from my remote server to this, my development workstation and have used the script presented here - a script that generates a CREATE statement for each login found. While I was preparing to run this script's output (from the remote box) i needed to change the domain name from the remote to my local's name - so i ran the same script locally (in order to see what SQL things my domain name is.

SQL has the original machine name - the one with the typo. However, the scripts are tossing errors if i try to create logins with that identifier.

CREATE LOGIN [Setve\Admin] FROM WINDOWS WITH DEFAULT_DATABASE = [master]

But works correctly if i use the updated machine name: CREATE LOGIN [Steve\Admin] FROM WINDOWS WITH DEFAULT_DATABASE = [master]

So the problem is: do i have a problem i need to solve? Somewhere, deep in the guts of SQL Server, it has record of a Domain name that does not exist. Should i find and fix that discrepancy?

thx

share|improve this question

1 Answer 1

up vote 6 down vote accepted

To check what SQL Server thinks your machine is named, execute the following:

SELECT @@SERVERNAME AS 'Server Name'

If Server Name returns the typo'd name, you can change it with:

sp_dropserver <old_name>
GO
sp_addserver <new_name>, local
GO

This article on MSDN documents SQL Server renaming quite well.

Edit: Per your comment, much like renaming a Windows computer, you will need to restart the SQL Server service for the changes to take effect.

REM Stop SQL Server
sc stop mssqlserver

REM Wait a little bit, and/or run
sc query mssqlserver
REM will tell you the status of the service.


REM Start SQL Server
sc start mssqlserver

You can also stop/start SQL Server from within SSMS.

share|improve this answer
    
much appreciated - the commands executed without error, but initially, the new name didn't show up until after restarting. suggest editing your reply to include that. again...thx –  justSteve Dec 24 '10 at 15:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.