Search

Wednesday, April 17, 2013

How many SQL Server Instances are installed on a server?

Create Table #SQLInstances
( Value nvarchar(100),
 InstanceName nvarchar(100),
 Data nvarchar(100))
-- Read Data from Registery
Insert into #SQLInstances
EXECUTE xp_regread
  @rootkey = 'HKEY_LOCAL_MACHINE',
  @key = 'SOFTWARE\Microsoft\Microsoft SQL Server',
  @value_name = 'InstalledInstances'

Select InstanceName from #SQLInstances
-- Clear the temp table
drop table #SQLInstances

No comments:

Post a Comment