One of the first things we do when inheriting a new SQL Server environment or when troubleshooting issues, knowing SQL Server version. There are different ways to get SQL Server information. Here is a script to find SQL Server version information.

1_script to find sql server version

The @@VERSION returns the SQL Server build information for the current installation of SQL Server. The SQL version from the above snapshot is SQL Server 2014 Enterprise Edition with build number 12.0.2000. It also returns the windows version the SQL server is installed on.

Another way is to use the SERVERPROPERTY function as shown below.

2_script to find sql server version

The Product Version returned by SERVERPROPERTY function can be formatted to return the SQL Server version as shown below.

3_script to find sql server version

The above query can be used to make inventory of all the SQL Server version in an environment for monitoring or patching purpose.



Ahmad Osama

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook