Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 658
Steve Avatar asked Nov 27 '25 22:11

Steve


2 Answers

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')
like image 75
nick_alot Avatar answered Nov 30 '25 12:11

nick_alot


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)

like image 22
Gareth Avatar answered Nov 30 '25 11:11

Gareth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!