Walker News

How To Check Microsoft SQL Server 2008 Version And Bitness?

Just wonder what are the Transact-SQL system functions used by administrator to check Microsoft SQL Server 2008 version and bitness (32-bit or 64-bit).

With reference to Microsoft KB 321185 and Microsoft SQL Server Books Online, I just learn how to use sqlcmd (command-line utility) to check MS SQL Server release, version number, edition, bitness, and service pack level (below).

Using @@Version to retrieve all details at one go

@@Version is one of the Transact-SQL configuration functions:
C:\Walker>sqlcmd -S WALKERW7\SQLEXPRESS
1> select @@version
2> go

-----------------------------------------------------------------------
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64)
        Mar 29 2009 10:11:52
        Copyright (c) 1988-2008 Microsoft Corporation
        Express Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )

(1 rows affected)
1> quit

Using SERVERPROPERTY to retrieve selective details

SERVERPROPERTY is one of the Transact-SQL system functions:
C:\Walker>sqlcmd -S WALKERW7\SQLEXPRESS
1> :Setvar SQLCMDMAXFIXEDTYPEWIDTH 26
2> SELECT @@version,
3> SERVERPROPERTY ('Edition'),
4> SERVERPROPERTY ('ProductLevel'),
5> SERVERPROPERTY('ProductVersion')
6> go

-------------------------- -------------------------- -------------------------- --------------------------
Microsoft SQL Server 2008  Express Edition (64-bit)   SP1                        10.0.2531.0

(1 rows affected)
1> quit

NOTE:
  • Replace red-color text (WALKERW7) with your SQL Server name and blue-color text (SQLEXPRESS) with your SQL Server instance name. The SQL Server name is usually “computer name” of Windows machine where the SQL Server running. To check Windows server computer name, just type echo %ComputerName% at Command Prompt (cmd.exe).
     
  • SQLCMDMAXFIXEDTYPEWIDTH is one of the sqlcmd scripting variables. If you want to fix SQL output column width, this formatting option is desirable to limit the number of characters returned for large variable length data types, which include but not limited to varchar, nvarchar, varbinary, xml, UDT, text, ntext, and image.
    The ability to fix SQL output column width not only enhances readability but also improve performance if SQL output is transferred over TCP/IP network.

The sqlcmd is one of the many command prompt utilities bundled with SQL Server 2008 installation (available since SQL Server 2005), to allow administrator executes Transact-SQL statements, system procedures, and script files at Windows Command Prompt window.

Custom Search

2016  •  Privacy Policy