I'm trying to get the server name programmatically.
Even after I do this:
exec dbo.sp_dropserver 'FQDN\InstanceName'
exec dbo.sp_addserver 'MURPHY', 'local'
But @@Servername and SERVERPROPERT('ServerName') both still return FQDN\InstanceName
In our code, we do stuff like IF <this servername> = "FQDN\InstanceName" ....
I want to be able to do IF <this servername> = "MURPHY" .... because we're getting brand new equipment and they won't be renaming them to match the old names.
There's gotta be a a way...surely?