|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, March 25, 2013 1:18 AM
Points: 718,
Visits: 831
|
|
Hi All,
How to find out Installed SQL Server Instances and their names on a server using T-SQL or any other way ?
Thanks and Regards!!
Raghavender Chavva
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, March 25, 2013 1:18 AM
Points: 718,
Visits: 831
|
|
I think below will give the expected result:
-- Create Temporary table to store the data 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
Thanks and Regards!!
Raghavender Chavva
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Monday, March 25, 2013 1:18 AM
Points: 718,
Visits: 831
|
|
Raghavender (9/14/2011) I think below will give the expected result:
-- Create Temporary table to store the data 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
Here can we find out which instance is running and which is not ?
Thanks and Regards!!
Raghavender Chavva
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 3:17 PM
Points: 715,
Visits: 1,524
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:10 PM
Points: 876,
Visits: 3,731
|
|
Raghavender (9/13/2011) Hi All,
How to find out Installed SQL Server Instances and their names on a server using T-SQL or any other way ?
The easiest way for me is, go to services and check the sql server services. If its named instance then your sql service will be named as mssql$instancename, if its default instance then simply mssqlserver.
---------- Ashish
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 3:17 PM
Points: 715,
Visits: 1,524
|
|
crazy4sql (9/14/2011)
Raghavender (9/13/2011) Hi All,
How to find out Installed SQL Server Instances and their names on a server using T-SQL or any other way ?The easiest way for me is, go to services and check the sql server services. If its named instance then your sql service will be named as mssql$instancename, if its default instance then simply mssqlserver.
I think this becomes bit difficult if we have 100 instances or more ..
Thank You,
Best Regards, SQLBuddy
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:10 PM
Points: 876,
Visits: 3,731
|
|
I think this becomes bit difficult if we have 100 instances or more  .. Thank You, Best Regards, SQLBuddy
100 instance in one server. tell me your server name and I am going to report it to MS  
---------- Ashish
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 3:17 PM
Points: 715,
Visits: 1,524
|
|
crazy4sql (9/14/2011)
I think this becomes bit difficult if we have 100 instances or more  .. Thank You, Best Regards, SQLBuddy 100 instance in one server.  tell me your server name and I am going to report it to MS   
No .. Please don't report it to MS ..
Thank You,
Best Regards, SQLBuddy
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 12:58 AM
Points: 50,
Visits: 322
|
|
Hi,
Get SQL server information in OS registry levels.
Irrespective of the version of SQL Server, information is saved in the registry. Only the location changes for various versions. The path in the registry is as follows. SQL Server Default Instance(2000) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Setup SQL Server Default Instance(2005) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup SQL Server Named Instance (2008) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.ONE\Setup
Best Regards, Rama Udaya.K
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 3:28 PM
Points: 108,
Visits: 216
|
|
If you can lookup how to capture info from a command prompt and put it into a table, you could use the command:
Net start
To list all running processes. Joined with the the info from the registry, you cab figure out the started and stopped versions of SQL.
If you want to keep it all in the registry, they key will be something like
Hklm\services\control\current version\mssql(instance)
(^^^ the above key is not correct as I'm not near a windows PC to check. It is approximately right.)
This will give you the actual status of each service, e.g. start, stopped, paused (probably numeric values for each). Overkill?
If it were me, I'd use the net start command as I don't need to list all the registry keys and then search its values.
Wayne
Did you get access denied? Great the security works.
|
|
|
|