Quantcast
Channel: Solved » sql-server
Viewing all articles
Browse latest Browse all 48

How Can I Determine Installed Sql Server Instances and Their Versions

$
0
0

I’m trying to determine what instances of sql server/sql express I have installed (either manually or programmatically) but all of the examples are telling me to run a SQL query to determine this which assumes I’m already connected to a particular instance.

Solution

You could query this registry value to get the SQL version directly:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion

Alternatively you can query your instance name and then use sqlcmd with your instance name that you would like:

To see your instance name:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names

Then execute this:

SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

If you are using C++ you can use this code to get the registry information.

The post How Can I Determine Installed Sql Server Instances and Their Versions appeared first on Solved.


Viewing all articles
Browse latest Browse all 48

Trending Articles