Translate

Saturday, January 30, 2010

Version Information on SQL Server

If you want to find out version information, you can use @@Version function. However, in SQL Server 2005, you won’t get the service pack level of the SQL Server.

If you run SELECT @@VERSION in SQL Server 2005, you will get following output.

Microsoft SQL Server 2005 - 9.00.4207.00 (X64) Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2)

PN: here Service Pack 2 means service pack of the operating system, not the service pack of the SQL Server. To find out the service pack level in SQL Server 2005, you need to run following T-SQL.

SELECT SERVERPROPERTY('ProductLevel') ServicePack

In SQL Server 2008 this is what you get for SELECT @@VERSION.

Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) Copyright (c) 1988-2008 Microsoft Corporation Developer Edition (64-bit) on Windows NT 5.2 <X64> (Build 3790: Service Pack 2)

In this you can see that you will get the Service pack level from the @@VERSION.

Apart from above commands, following stored procedures also give you the server information.

EXEC master..xp_msver

EXEC sp_server_info

No comments:

Post a Comment