Steve
Steve

Reputation: 6460

Is it possible to programmatically distinguish between versions of SQL Server?

Basically, is it possible to identify if some-one hooks up my program to SQL server Compact or Express Edition? I want to be able to restrict different versions of my product to different versions of SQL Server.

Upvotes: 3

Views: 565

Answers (4)

splattne
splattne

Reputation: 104030

The Microsoft Knowledgebase article KB321185 describes how to identify your current Microsoft SQL Server version number and the corresponding product or service pack level.

It also describes how to identify the specific edition if you are using Microsoft SQL Server 2000 or Microsoft SQL Server 7.0.

Upvotes: 1

PEZ
PEZ

Reputation: 17004

There's also the SERVERPROPERTY function that can give you things like 'edition':

SELECT SERVERPROPERTY ('edition')

Upvotes: 0

nick_alot
nick_alot

Reputation: 3012

After connection to a database, you can always run the T-Sql:

SELECT SERVERPROPERTY ('edition')

This should give you the different editions

Other useful info may come from:

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

Upvotes: 5

Gareth
Gareth

Reputation: 2200

Run this SQL statement

SELECT @@VERSION

and it'll give you a ReultSet (one column as a String) with the version like this

Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)

Upvotes: 2

Related Questions