Connect to a Microsoft SQL Server database, and execute @@VERSION function to find out the version, processor architecture, build date, and operating system for the current installation of SQL Server.
-- Define the SQL Server version SELECT @@VERSION;
The query result on SQL Server 2012
Version |
Microsoft SQL Server 2012 - 11.0.2100.60 (Intel X86) Feb 10 2012 19:13:17 Copyright © Microsoft Corporation Express Edition on Windows NT 6.1 <X86> (Build 7601: Service Pack 1) |
SQL Server 2008 R2:
Version |
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86) Jul 9 2008 14:43:34 Copyright © 1988-2008 Microsoft Corporation Express Edition on Windows NT 6.1 <X86> (Build 7601: Service Pack 1) |
@@VERSION function returns a single string, and you can also use SERVERPROPERTY function to retrieve the individual values:
-- Get SQL Server edition SELECT SERVERPROPERTY('Edition');
The query result:
Edition |
Express Edition |
-- Get product version (Major.Minor.Build.Revision) SELECT SERVERPROPERTY('ProductVersion');
The query result on SQL Server 2012:
Product Version |
11.0.2100.60 |
SQL Server 2008 R2:
Product Version |
10.0.1600.22 |
Last Update: Microsoft SQL Server 2012