You can use SELECT @@VERSION , which returns a rather verbose string.
Itβs easier to look at the database compatibility level with
select compatibility_level from sys.databases where name=db_name()
This returns a numeric value. Common values ββsuch as:
80 = SQL Server 2000
90 = SQL Server 2005
100 = SQL Server 2008
This gives an additional advantage in verifying that the database on the server is at the required level, and not only on the server itself on which a particular version of the system is installed.
source share