How to know the SQL Server Version

In order to know the SQL Server and Edition details you would be possibly looking at the SQL Server properties and find out the details. Occasionally it might be needed to check the same as part of a job / or a script, you need to query the SQL Server for this info. In order to do this you can use @@Version to retrieve the installation information of SQL Server.

The following images displays the output from the same T-SQL command when run on different types of SQL installations.

The above result indicates the SQL Server is 2008 Developer Edition running 64-bit version of the SQL Server. Note that it displays some details about the operating system too. Here in the above case it is Windows Server 2008 and the machine is a Virtual Machine.

The above result is displayed when executed on an instance running SQL Server 2000 Enterprise Edition hosted by a Windows Server 2003. Note that it displays the Service Pack 2 for the Windows Server 2003 and the service pack information is not for the SQL Server.

It is through experience we know how to identify the Windows Server Version (2003 or 2008) by looking at the Windows NT 5.2 (for 2003) and 6.1 (for 2008) etc.

Use the following script.

SELECT @@VERSION AS [VERSION DETAILS]

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru so that, you know when there is a new blog post.

– Bru Medishetty