Home > SQL Scripts > Get Installed SQL Server Instance on a Server

Get Installed SQL Server Instance on a Server

 

Developed the script to get installed SQL Server Instance on a Server. To run this script user should have admin privileges or minimum permission to read OS registry on the server.

DECLARE @Registry_Value VARCHAR(1000)

DECLARE @SQL_In AS
TABLE (Id NVARCHAR(MAX),InsName NVARCHAR(25))

 

INSERT
INTO @SQL_In(Id,InsName)

EXECUTE
xp_regread
‘HKEY_LOCAL_MACHINE’,‘SOFTWARE\Microsoft\Microsoft SQL Server’,‘InstalledInstances’,

@Registry_Value OUTPUT

 

SELECT
@@ServerName [Server Name],InsName [Installed SQL Instance] FROM @SQL_In

 

Categories: SQL Scripts
  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: