Friday, February 10, 2012

check sql server edition

is there a way to get the edition(e.g. sqlexpress,enterprise etc...) of an installed sql server instance in your local machine programatically?

Code Snippet

select serverproperty('Edition')

HTH!|||alright! thanks man! Smile but is there some other way... without executing a query from the server?|||

I guess another way would be to query the registry for the information. Looking around there appears to be that information in the registry key for SQL2005:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\Edition

HTH!

|||

i've checked my registry... but it seems its not correct to read the registry when checking an installed sqlserver edition... it's not accurate..my machine have some previous sqlserver installations before and my registry looks like this..

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\Edition\Developer Edition

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.2\Setup\Edition\DeveloperEdition

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.3\Setup\Edition\Express Edition

...

...

......

.........

............

...............

but there is only one developer edition instance installed in my machine...

|||

Hi,

I guess your registry showing is correct.

During SQL Server Setup, an instance ID is generated for each server component. The server components in this SQL Server release are the Database Engine, Analysis Services, and Reporting Services. The instance ID is in the format MSSQL.n, where n is the ordinal number of the component being installed. The instance ID is used in the file directory and the registry root.

The first instance ID generated is MSSQL.1; ID numbers are incremented for additional instances as MSSQL.2, MSSQL.3, and so on. If gaps occur in the ID sequence due to uninstalls, ID numbers are not generated to fill them. The most recently installed instance always has the highest instance ID number.

Server components are installed in directories with the format <instanceID>\<component name>. For example, a default or named instance with the Database Engine, Analysis Services, and Reporting Services would have the following default directories:

<Program Files>\Microsoft SQL Server\MSSQL.1\MSSQL\ for the Database Engine

<Program Files>\Microsoft SQL Server\MSSQL.2\OLAP\ for Analysis Services

<Program Files>\Microsoft SQL Server\MSSQL.3\RS\ for Reporting Services

No comments:

Post a Comment