How to find your overall hot fix compliancy rate for servers only

Set Nocount OFF
Declare @Installed as int
Declare @Total as int
Declare @Per as Float

set @Installed = (SELECT SUM(CASE WHEN patch.Status0 = ‘Installed’ THEN 1 ELSE 0 END) as ‘Installed’  FROM  v_GS_PATCHSTATEEX  patch, v_GS_SYSTEM SYS where SYS.systemrole0 = ‘server’ and SYS.ResourceID = Patch.ResourceID)
set @Total = (SELECT count(patch.Status0)FROM v_GS_PATCHSTATEEX  patch, v_GS_SYSTEM SYS where SYS.systemrole0 = ‘server’ and SYS.ResourceID = Patch.ResourceID)
set @Per = (select Sum(@installed*100/@total))

SELECT @Installed as ‘Installed’,
@total as ‘Total’,
@Per as ‘Percent’

Leave a Reply

Your email address will not be published. Required fields are marked *