I created a sql server instance and the name show up differently in test and prod. How can i change the prod name to not have the names repeating ?

Prod :

select @@servername EHCPSQL12\EHCPSQL12

select @@servername + '\' + @@servicename EHCPSQL12\EHCPSQL12\EHCPSQL12

Test :

select @@servername EHCXSQL12

select @@servername + '\' + @@servicename EHCXSQL12\MSSQLSERVER


To change the name of a named instance

sp_dropserver 'Server Name\old_Instance_name'
sp_addserver 'ServerName\New Instance Name','local'

Verify sql server instance configuration by running below queries

select @@servername

Restart the SQL Server Services.

net stop MSSQLServer
net start MSSQLServer
| improve this answer | |
  • I tried but it still stays like EHCPSQL12\EHCPSQL12, why is it showing up twice and thrice ? – user1918074 May 6 '16 at 17:47
  • Sounds like you installed it as a named instance when you wanted a default instance. Try this answer, stackoverflow.com/questions/35026/… – tpet May 6 '16 at 18:41
  • @user1918074 A default instance will return ServerName\MSSQLSERVER for SELECT @@servername + '\' + @@servicename. – tpet May 6 '16 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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