T-SQL Query to find list of Instances Installed on a machine | SansSQL

Sunday, March 13, 2011

T-SQL Query to find list of Instances Installed on a machine

Here is a T-SQL Query to find the list of instances Installed on a machine.

DECLARE @GetInstances TABLE
( Value nvarchar(100),
 InstanceNames nvarchar(100),
 Data nvarchar(100))

Insert into @GetInstances
EXECUTE xp_regread
  @rootkey = 'HKEY_LOCAL_MACHINE',
  @key = 'SOFTWARE\Microsoft\Microsoft SQL Server',
  @value_name = 'InstalledInstances'
 
Select InstanceNames from @GetInstances

OR

Create Table #GetInstances
( Value nvarchar(100),
 InstanceNames nvarchar(100),
 Data nvarchar(100))

Insert into #GetInstances
EXECUTE xp_regread
  @rootkey = 'HKEY_LOCAL_MACHINE',
  @key = 'SOFTWARE\Microsoft\Microsoft SQL Server',
  @value_name = 'InstalledInstances'
 
Select InstanceNames from #GetInstances

drop table #GetInstances

Both the queries are almost similar, except for that first query uses a table variable and the second one uses temporary table.

3 comments:

markson said...

Before digging further into the subtleties of how to play video poker, what precisely are the advantages of playing the game? machine learning course

indomakmur said...

Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s challenging to get that “perfect balance” between user friendliness and appearance. I must say you’ve done a excellent job with this. Also, the blog loads very quick for me on Safari. Superb Blog! https://royalcbd.com/product/cbd-gummies-25mg/

Huongkvb said...

Mua vé tại đại lý vé máy bay Aivivu, tham khảo

vé máy bay đi Mỹ

có vé máy bay từ mỹ về việt nam chưa

vé máy bay từ frankfurt đi hà nội

lịch bay từ moscow đến hà nội

lịch bay từ anh về việt nam hôm nay

lịch bay từ pháp về việt nam

ve may bay cho chuyen gia nuoc ngoai

Post a Comment

Ads