Home > SQL Server > Get SQL Server and Service name – SQL Server

Get SQL Server and Service name – SQL Server


@@ServerName : This function returns the server name in which the SQL Server is installed. Servername will be set during the installation. But, we can also change the servername using sp_addserver procedure and we must restart SQL Server.

pic1We get different output based on the installation as shown below.

pic2@@ServiceName : This function returns SQL server service/instance name.

pic3It returns ‘MSSQLServer’ if it is a default instance otherwise instance name .

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: