SQL Server Name and Instance Name


There are times you would want to get the name of the SQL server and instance id, use the following command in a sql shell:

select @@servername + ‘\’ + @@servicename

image

select @@servername + ‘\’ + @@servicename