Reputation: 1171
I want to know if there is a T-SQL statement that returns the Server name of a SQL Server.
Upvotes: 3
Views: 7529
Reputation: 280252
This will give the actual physical machine name (e.g. in case of a cluster) as well as the server\instance name:
SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS'), @@SERVERNAME;
Upvotes: 18
Reputation: 147224
One way is as follows:
SELECT @@SERVERNAME
Another way:
SELECT SERVERPROPERTY('ServerName')
Upvotes: 10