« Demotivational Posters | Main | Trouble Accessing Windows Update Yesterday »

Rename a SQL 2000 Computer

Every time I rename a SQL 2000 computer (yes I do it often in Virtual PC test/demo installs) I lose about 15 minutes hunting for the stored procedure that needs to be run. I should know it off the top of my head now, but I don't. So I'll post it here for my future reference.

sp_dropserver 'old_server_name'
go
sp_addserver 'new_server_name', 'local'

Restart the SQL service and verify the name change:

SELECT @@SERVERNAME

and

SELECT ServerProperty('ServerName')

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)