SQL Stuff

Find SQL Server Versions And Patches That You Need

Here’s some SQL logic that will show you the SQL Server Version and will list the Patches the servers need if you’re behind on your versioning. Works up to SQL Server 2014.


use master;

set nocount on

select

'SQL Version' = right(left(@@version, 25), 15)

, 'Service Pack' = serverproperty('productlevel')

, 'R2?' =

case

when serverproperty('productversion') between '10.50.0000.0' and '10.51.0000.0' then ' R2'

else ''

end

, 'Current' =

case

when serverproperty('productversion') between '9.0.1399.06' and '9.0.4036' then 'Requires SQL 2005 SP4'

when serverproperty('productversion') between '10.0.1600.21' and '10.0.5500.1' then 'Requires SQL 2008 SP4'

when serverproperty('productversion') between '10.50.1600.0' and '10.50.4000.1' then 'Requires SQL 2008 R2 SP3'

when serverproperty('productversion') between '11.0.2100.59' and '11.0.3000.1' then 'Requires SQL 2012 SP2'

when serverproperty('productversion') between '12.0.2000.7' and '11.0.3000.0' then 'Requires SQL 2012 SP2'

else

'Current'

end

, 'Build Number' = serverproperty('productversion')

Results will look like this when applied to multiple servers.

Advertisements

Categories: SQL Stuff

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