Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to detect SQL server edition

310 views
Skip to first unread message

Will

unread,
Dec 21, 2004, 6:59:07 PM12/21/04
to
I need a programmatic way of detecting the edition of SQL Server that is
installed.

I am aware of the "select SERVERPROPERTY('edition')" query, however I cannot
use this as the program that runs the test may not have access to the SQL
Server DB.

I am also aware of the fact that the SQL Server error log (ERRORLOG)
contains a string that identifies the edition. However as far as I can tell
this error log is not always present.

Is anyone aware of other reliable methods?

Thanks,
Will

David Gugick

unread,
Dec 21, 2004, 7:36:27 PM12/21/04
to

You can grab it from the registration database as long as the remote
registry service is running on the server and you know where to look.
There are differences between SQL 2000 default and named instances.

See:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion

and the CSDVersion key.

You can use something like the .Net OpenRemoteBaseKey method to open the
key remotely.


--
David Gugick
Imceda Software
www.imceda.com

Will

unread,
Dec 21, 2004, 7:55:01 PM12/21/04
to

Hi David,

Thanks for the tip, but in the default SQL Server 2000 installations that I
have looked at, the CSDVersion registry valuename does not exist. I do
however see the

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion

key.

These SQL server instances are installed on Windows 2000 Adv Svr

Any idea why the valuename is missing?

Thanks,
Will

William Wang[MSFT]

unread,
Dec 22, 2004, 2:11:31 AM12/22/04
to
Hi Will,

If I understand correctly, you want to identify the
edition of SQL Server (for example, Enterprise or
Standard) rather than its product version (for example,
8.00.760). However, the CSDVersion registry entry
contains the product verison which may not be what you
want.

I suggest that you get the edition information from the
SQL error log if using T-SQL is not appropriate. The log
is always present.

You can refer to the following article for more
information:

321185 HOW TO: Identify Your SQL Server Service Pack
Version and Edition
http://support.microsoft.com/?id=321185

If anything is unclear, please feel free to let me know.

Sincerely,

William Wang
Microsoft Online Partner Support

Get Secure! - <www.microsoft.com/security>

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and
confers no rights.

--------------------
>Thread-Topic: How to detect SQL server edition
>thread-index: AcTnwN3HSUnEsC8DRUG+mvPJFwddbA==
>X-WBNR-Posting-Host: 24.85.242.45
>From: "=?Utf-8?B?V2lsbA==?="
<will4...@community.nospam>
>References:
<2687E5C8-D19D-4D2C...@microsoft.com>
<uhaP#475EH...@TK2MSFTNGP12.phx.gbl>
>Subject: Re: How to detect SQL server edition
>Date: Tue, 21 Dec 2004 16:55:01 -0800
>Lines: 44
>Message-ID:
<517647E3-18E2-43D5...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.programming
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.programming:493118
>X-Tomcat-NG: microsoft.public.sqlserver.programming

Will

unread,
Dec 22, 2004, 2:25:01 PM12/22/04
to
"William Wang[MSFT]" wrote:
> Hi Will,
>
> If I understand correctly, you want to identify the
> edition of SQL Server (for example, Enterprise or
> Standard) rather than its product version (for example,
> 8.00.760). However, the CSDVersion registry entry
> contains the product verison which may not be what you
> want.
>
> I suggest that you get the edition information from the
> SQL error log if using T-SQL is not appropriate. The log
> is always present.
>
> You can refer to the following article for more
> information:
>
> 321185 HOW TO: Identify Your SQL Server Service Pack
> Version and Edition
> http://support.microsoft.com/?id=321185
>
> If anything is unclear, please feel free to let me know.
>
> Sincerely,
>
> William Wang
> Microsoft Online Partner Support

Hi William,

You did indeed understand me correctly. :)

However as I said in my initial posting (to the best of my
knowledge) the error log is _not_ always present. From what
I can tell, its presence (or absence) is dictated by the
"-e" SQLServer parameter.

For example on my default SQL Server 2000 Enterprise
installation (on Windows 2000 Adv Svr) the ERROR log is only
written if there is a "SQLArg#" ValueName of
"-eC:\Program Files\Microsoft SQL Server\MSSQL\log\ERRORLOG"
beneath the registry key
"HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters".

I have proved this by deleting the VAlueName and restarting the
MSSQLSERVER service. When I do that the error log is not written.
And when I recreate the ValueName and restart the service, the
error log is written again.

Hence my question is there any _other_ way to programmatically
determine the edition.

Thanks,
Will

William Wang[MSFT]

unread,
Dec 22, 2004, 11:37:14 PM12/22/04
to
Hi Will,

When we install SQL Server, SQL Server Setup writes a
set of default startup options in the registry. -e is
the fully qualified path for the error log file,
normally we should not remove it. If this is not
acceptable to you, and if you cannot connect to the SQL
Server, I'm afraid there is not another way to identify
the edition.

If I can be of any further assistance, please feel free
to let me know.

Sincerely,

William Wang
Microsoft Online Partner Support

Get Secure! - <www.microsoft.com/security>

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and
confers no rights.

--------------------
>Thread-Topic: How to detect SQL server edition

>thread-index: AcToW+56Cb6h81PRRWqIrpL12aY0cA==


>X-WBNR-Posting-Host: 24.85.242.45
>From: "=?Utf-8?B?V2lsbA==?="
<will4...@community.nospam>
>References:
<2687E5C8-D19D-4D2C...@microsoft.com>
<uhaP#475EH...@TK2MSFTNGP12.phx.gbl>

<517647E3-18E2-43D5...@microsoft.com>
<cyW56V$5EHA...@cpmsftngxa10.phx.gbl>


>Subject: Re: How to detect SQL server edition

>Date: Wed, 22 Dec 2004 11:25:01 -0800
>Lines: 54
>Message-ID:
<D3A68FA3-8C25-4AD1...@microsoft.com>


>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.programming
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: cpmsftngxa10.phx.gbl

microsoft.public.sqlserver.programming:493323
>X-Tomcat-NG: microsoft.public.sqlserver.programming

Will

unread,
Dec 22, 2004, 11:49:02 PM12/22/04
to

"William Wang[MSFT]" wrote:

> Hi Will,
>

> When we install SQL Server, SQL Server Setup writes a
> set of default startup options in the registry. -e is
> the fully qualified path for the error log file,
> normally we should not remove it. If this is not
> acceptable to you, and if you cannot connect to the SQL
> Server, I'm afraid there is not another way to identify
> the edition.
>
> If I can be of any further assistance, please feel free
> to let me know.
>
> Sincerely,
>
> William Wang
> Microsoft Online Partner Support
>

Hi William,

Not the answer that I was hoping for, but at least it is definitive. Thanks
for your time, I appreciate it.

Will

William Wang[MSFT]

unread,
Dec 23, 2004, 2:39:43 AM12/23/04
to
Hi Will,

Thanks for the update. Feel free to let us know if we
can assist you at any time.

Sincerely,

William Wang
Microsoft Online Partner Support

Get Secure! - <www.microsoft.com/security>

=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and
confers no rights.

--------------------
>Thread-Topic: How to detect SQL server edition

>thread-index: AcToqrllYinycxlGT4OHHU2Xdy4GPA==


>X-WBNR-Posting-Host: 24.85.242.45
>From: "=?Utf-8?B?V2lsbA==?="
<will4...@community.nospam>
>References:
<2687E5C8-D19D-4D2C...@microsoft.com>
<uhaP#475EH...@TK2MSFTNGP12.phx.gbl>
<517647E3-18E2-43D5...@microsoft.com>
<cyW56V$5EHA...@cpmsftngxa10.phx.gbl>

<D3A68FA3-8C25-4AD1...@microsoft.com>
<5yikYkK6...@cpmsftngxa10.phx.gbl>


>Subject: Re: How to detect SQL server edition

>Date: Wed, 22 Dec 2004 20:49:02 -0800
>Lines: 29
>Message-ID:
<441E94D4-007E-4CE6...@microsoft.com>


>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.programming
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: cpmsftngxa10.phx.gbl

microsoft.public.sqlserver.programming:493411
>X-Tomcat-NG: microsoft.public.sqlserver.programming

Abbey

unread,
Oct 28, 2005, 12:01:04 PM10/28/05
to
Hello,

I have a question *almost* identical to this. The difference is that I need
to detect whether the computer has SQL Server 2000 SP3 installed before
attempting to connect to it, for example during my custom setup program. What
is the recommended way of doing this?

A.

Aaron Bertrand [SQL Server MVP]

unread,
Oct 28, 2005, 12:11:20 PM10/28/05
to
Well, you could check the registry for the install folder and then use
filesystemobject to check the version of sqlservr.exe... (in fact, the
version may be in the registry in the first place)...

"Abbey" <Ab...@discussions.microsoft.com> wrote in message
news:F7BD91A1-96AD-4F63...@microsoft.com...

Niranjan

unread,
Aug 30, 2006, 2:31:01 AM8/30/06
to
Hi William,

I have a similar requirement here. Except that I am trying to find the SQL
Server Version from a VB.net console application. My requirement is that I
have a machine having both SQL Server 2000 Ent Edition and SQL Server Express
Edition (more popularly 2005). I see that when both these servers are on the
same machine, then 2000 takes precedence. Is this expected behavior? Also is
there any fixed Registry Key to check for the SQL Server version w/o using
T-SQL. Currently i am using the SQLConnection.ServerVersion property from
.NET to get the SQL Server version. But further I also need to know the Data
folder and the Bin folder for SQL Server, which i can find from the setup
key in the registry. But in this case I am having many keys and I am finding
it a bit tedious to find the correct value. Please help me with this.

Regards,
Niranjan

Tibor Karaszi

unread,
Aug 30, 2006, 2:52:45 AM8/30/06
to
> see that when both these servers are on the
> same machine, then 2000 takes precedence.

What do you mean by "takes precendence"?

As for checking the registry for instances and versions, here's how it look if you have 2005
installed on the machine:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
Above has an entry named InstalledInstances listing all installed instances.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL
Above has an entry per installed 2005 instance, which can be used to find the Reg entry name and
folder name for that instance.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\CurrentVersion
Here you find the version for a particular instance.

I suggest you use VPC or VMWare to test some combinations of only 2000, 2000 and 2005 etc to use the
registry to detect these things.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/


"Niranjan" <Nira...@discussions.microsoft.com> wrote in message
news:01759702-D49C-40D1...@microsoft.com...

Niranjan

unread,
Aug 30, 2006, 3:13:01 AM8/30/06
to
Hi Tibor,

Sorry for not being more elaborate....Precedence in the sense if you have
SQL server 2000 and 2005 in the same machine, if we try to check the latest
version using SQLConnection.ServerVersion property, 08.xx.xx is returned
instead of 09.00.00. In case of JRE installation, the latest version would be
returned if you execute java -version in the command. (if you had 1.4.2, and
installed 1.5 then 1.5 specific version information would be returned).

I am checking the configurations using VMWare, :).

Tibor Karaszi

unread,
Aug 30, 2006, 3:22:49 AM8/30/06
to
I'm not familiar with that method (I'm more of an engine person), but I would assume that you
connect to an instance before you can use that method. Perhaps the API you are using tries to
connect to a default instance by default?


"Niranjan" <Nira...@discussions.microsoft.com> wrote in message

news:5BBB172E-07CC-4CA1...@microsoft.com...

0 new messages