Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

Undocumented strored procedure sp_MSgetversion will gives version information of sql server

Aug 5 2011 3:53AM by Niladri Biswas   

I just learned that there is an undocumented stored procedure sp_MSgetversion that will give us the current version of Microsoft SQL Server

EXEC master..sp_MSgetversion

will returns below 3 columns


/*

Character_Value                   
--------------- -- --
10.0.1600.22    1   3

*/

Read More..   [0 clicks]

Published under: SQL Server Tips ·  ·  ·  · 


Niladri Biswas
7 · 21% · 6710
9
 
4
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

5  Comments  

  • Note that this is undocumented. You can use other alternates http://beyondrelational.com/blogs/madhivanan/archive/2010/09/21/version-info.aspx

    commented on Aug 5 2011 5:55AM
    Madhivanan
    3 · 39% · 12429
  • Yep madhi, Safe use in production environments we can prefer other methods for retrieving the SQL Server version by "@@VERSION" or SERVERPROPERTY('ProductVersion')

    commented on Aug 5 2011 11:05AM
    Robert Dennyson
    11 · 14% · 4419
  • Below statement gives more details on installed version of SQL Server

    Select @@Version

    -- Result --

    Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86) Apr 2 2010 15:53:02 Copyright (c) Microsoft Corporation Developer Edition on Windows NT 6.1 (Build 7601: Service Pack 1)

    Thanks,

    commented on Aug 8 2011 12:20AM
    Hiren K
    539 · 0% · 68
  • Hiren, @@version will give you a lot of information, but it is difficult to parse.

    Getting information about the database instance is fairly easy: a combination of SERVERPROPERTY, sp_server_info and xp_msver. Any of these (or all of them) are much easier to parse if you want to do something based on the specific version of SQL or Windows that are being run.

    DECLARE @dbms_ver   TABLE (attribute_id int, attribute_name varchar(60), attribute_value varchar(255))
    DECLARE @msver  	TABLE ([index] int, name varchar(255), internal_value int, character_value varchar(255))
    DECLARE @msver_pvt  TABLE ([WindowsVersion] varchar(255), [Platform] varchar(255))
    
    INSERT INTO @dbms_ver(attribute_id, attribute_name, attribute_value)
    EXEC sp_server_info 2
    
    INSERT INTO @msver([index], [name], [internal_value], [character_value])
    EXEC xp_msver 'WindowsVersion'
    
    INSERT INTO @msver([index], [name], [internal_value], [character_value])
    EXEC xp_msver 'Platform'
    
    INSERT INTO @msver_pvt(WindowsVersion, [Platform])
    SELECT
        [WindowsVersion], 
        [Platform]
    FROM 
        (
        	SELECT name, character_value FROM @msver
        ) base
        	PIVOT
        		(
        			MIN([character_value])
        			FOR [name] IN ([WindowsVersion],[Platform])
        		) pvt
    
    SELECT
        d.attribute_value					as [sql version], 
        SERVERPROPERTY('Edition')			as [edition], 
        SERVERPROPERTY('ProductVersion')	as [product version], 
        SERVERPROPERTY('ProductLevel')		as [product level], 
        m.WindowsVersion					as [windows version], 
        m.Platform							as [platform]
    FROM
        @dbms_ver d, 
        @msver_pvt m
    
    commented on Jun 10 2012 7:39PM
    Marc Jellinek
    97 · 2% · 545
  • Hi All, One more Extended SP is there for version. xp_msver will give all details.

    commented on Jun 11 2012 12:30PM
    rajasekhar
    211 · 1% · 221

Your Comment


Sign Up or Login to post a comment.

"Undocumented strored procedure sp_MSgetversion will gives version information of sql server" rated 5 out of 5 by 9 readers
Undocumented strored procedure sp_MSgetversion will gives version information of sql server , 5.0 out of 5 based on 9 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]