How to determine SQL Server Version and Edition
Often in code you need to determine which version of SQL you are running against in a multi version environment. The ServerProperty function can help with this.
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
Example results are:
The product version (for example, "9.00.1399.06").
The product level (for example, "RTM").
The edition (for example, "Enterprise Edition").
| Release | Sqlservr.exe |
| RTM | 2005.90.1399 |
| SQL Server 2005 Service Pack 1 | 2005.90.2047 |
| SQL Server 2005 Service Pack 2 | 2005.90.3042 |
| RTM (SQL 2000) | 2000.80.194.0 |
| SQL Server 2000 SP1 | 2000.80.384.0 |
| SQL Server 2000 SP2 | 2000.80.534.0 |
| SQL Server 2000 SP3 | 2000.80.760.0 |
| SQL Server 2000 SP3a | 2000.80.760.0 |
| SQL Server 2000 SP4 | 2000.8.00.2039 |
Select @@Version will provide the Edition (Workgroup, Standard, etc).
