Different ways to find out SQL Server’s Version

Posted: September 6, 2012 by Virendra Yaduvanshi in Database Administrator
Tags: , ,

There are many options to find out SQL Server’s Version, some are as below,

— Option : 1
   SELECT  @@VERSION
— Option : 2
  SELECT  SERVERPROPERTY(‘ProductVersion’ ‘Version’, SERVERPROPERTY(‘ProductLevel’) ‘Service Pack’, SERVERPROPERTY    (‘Edition’‘Edition’
– Option : 3
   sp_server_info
— Option : 4
  xp_msver
— Option : 5
   sp_MSgetversion
— Option : 6
  SELECT  @@MicrosoftVersion /power(2,24)
— Option : 7

        — Finding values from Registry – For SQL Server 2005
xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\’,
@value_name=‘Version’
GO

xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\’,
@value_name=‘Edition’
GO

xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\’,
@value_name=‘SP’
GO

        — Finding values from Registry – For SQL Server 2008)
xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup\’,
@value_name=‘Version’
GO

xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup\’,
@value_name=‘Edition’
GO
xp_regread
@rootkey=‘HKEY_LOCAL_MACHINE’,
@key=‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Setup\’,
@value_name=‘SP’
GO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s