[sql server] La query SELECT @@SERVERNAME restituisce NULL
La variabile @@SERVERNAME ritorna NULL quando non ci sono righe nella tabella sys.servers con server-id=0. E’ possibile verificarlo eseguendo la query:
select * from sys.servers where server_id=0
Se non ritorna righe, è necessario aggiungere il server locale con il comando
sp_addserver 'NOME SERVER', local
e quindi riavviando il servizio.