HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Get major and minor version of SQL Server

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
majorserverversionminorsqlgetand

Problem

Running following query:

SELECT 
    SERVERPROPERTY('productversion') AS version,
    SERVERPROPERTY('ProductMajorVersion') AS major, 
    SERVERPROPERTY('ProductMinorVersion') AS minor;


produces the following results:

version      major   minor
------------ ------- -------
10.0.2531.0  NULL    NULL


What am I missing?

Solution

The ProductMajorVersion and ProductMinorVersion properties are only available in SQL Server 2012 and above (according to https://learn.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql). Your product version indicates that this is SQL Server 2008 SP1, which does not support the two other properties.

Context

StackExchange Database Administrators Q#180404, answer score: 9

Revisions (0)

No revisions yet.