Get them Server Properties

Though this may be trivial it is always useful. There are many ways to determine what version, edition and service pack level of SQL Server you are running. So here is a one way to get the information you need.


SELECT  RIGHT(LEFT(@@VERSION,25),15)        AS [Product]
	    ,SERVERPROPERTY('productversion')   AS [Version]
	    ,SERVERPROPERTY('edition')          AS [Edition]
	    ,SERVERPROPERTY('productlevel')     AS [Service Pack]
        ,SERVERPROPERTY('ServerName')       AS [ServerName]


5-26-2010 10-42-34 PM


If the char length of SQL Server 2008 changes then (line 1) will need to be adjusted accordingly. I haven’t searched for a better solution; however, if you know of one please feel free to pass on the information. I would appreciate it.

Updated: 2010-06-05

Recently as I was working more with CHARINDEX I thought I might use to extract the product from @@VERSION. The number 15 is the char length of SQL Server 2008. Hence the 15 of course.


It will return SQL Server 2008. Again if the product name changes CHAR length then this will be off.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s