how to get server name in sql server code example Example: server name sql server SELECT @@SERVERNAME AS 'Server Name'