programming.torensma.net: Code Snippets

How to: Get the name of the running SQL-server instance

Here’s a script to retrieve the name of the currently running SQL Server instance:

SELECT @@SERVERNAME AS 'ServerName'

Resultset:

ServerName
---------------------------
DEV-SQL

(1 row(s) affected)

You can follow any responses to this entry through the RSS 2.0 feed.