Search Suggest

How to change Sql Server name. A micro tips!

Hello friends,

Welcome back again!

Last time we have a long post about Disassembling the SQL Server parser so today we have a very short post...
Do you need to change the name of the instance of SQL Server?

Easy!

Let's step back

Some days ago i was connected with a customer.

I saw the name of the instance in the SSMS but if I execute a statement where the name of the server is explicited, like this:

 
select * from [instancename]. [database]. [dbo]. [Table]

I get the Error:

Messaggio 7202, livello 11, stato 2, riga 10
Non è stato possibile trovare il server 'xxxxxx' in sys.servers. Verificare che sia stato specificato il nome corretto del server. Se necessario, eseguire la stored procedure sp_addlinkedserver per aggiungere il server a sys.servers.



Where is the problem?

If i execute the command 

 
Select * from sys.sysservers

The servaname columns return a name that's not equal to the name displayed by the SSMS

 

So, how to solve?

As I sayd this is a very easy tips!
Just type into your SSMS and then execute this two commands:

 
EXEC SP_DROPSERVER 'OLDNAME'
EXEC SP_ADDSERVER 'NEWNAME',local

 

Finally RESTART Sql Server.


Thanks to all & Remember to think big and always share the knowledge!















إرسال تعليق