0

I realize this is might be an unusual request. I'm trying to create a compliance report.

The following query needs to be altered to verify certain returned items. The returned values will be either compliant, non-compliant (displaying the version 3), or missing. I tried using case statement however if the item is missing nothing is returned.

SELECT TOP (100) PERCENT 
    dbo.v_Add_Remove_Programs.DisplayName0, 
    dbo.v_Add_Remove_Programs.Version0
FROM 
    dbo.v_Add_Remove_Programs 
INNER JOIN 
    dbo.v_R_System ON dbo.v_Add_Remove_Programs.ResourceID = dbo.v_R_System.ResourceID
WHERE 
    (dbo.v_R_System.Netbios_Name0 LIKE 'isa-lab0277') 
    AND (NOT (dbo.v_Add_Remove_Programs.Version0 = 'NULL'))
ORDER BY 
    dbo.v_Add_Remove_Programs.DisplayName0

Logic

  • If X = Y then mark compliant, if Y is missing mark it missing and not compliant, if Y is the wrong version return the value and mark it not compliant

Return values for X and Y. Return if the item is compliant or not (X=Y or X != Y)

Example Solution

Logic Requested by Kevin

If X = Y then mark compliant, if Y is missing mark it missing and not compliant, if Y is the wrong version return the value and mark it not compliant

Return values for X and Y. Return if the item is compliant or not (X=Y or X != Y)

Example solution report

STD Software Configuration    System Configuration Items    Status
Active Client 1.0.123     Active Client 1.0.123         Compliant
Adobe Flash Player 10.4.6.1   Adobe Flash Player 10.3.0.1   Not Compliant
Adobe Reader 1.9.123      none                          Missing
4

1 回答 1

0

如果您真的在测试缺失值,那么您需要更改 NULL 比较的标准

SELECT TOP (100) PERCENT 
    dbo.v_Add_Remove_Programs.DisplayName0, 
    dbo.v_Add_Remove_Programs.Version0
FROM 
    dbo.v_Add_Remove_Programs 
INNER JOIN 
    dbo.v_R_System ON dbo.v_Add_Remove_Programs.ResourceID = dbo.v_R_System.ResourceID
WHERE 
    (dbo.v_R_System.Netbios_Name0 LIKE 'isa-lab0277') 
    AND (NOT (dbo.v_Add_Remove_Programs.Version0 IS NULL)) --<<<<<<<<< Look here
ORDER BY 
    dbo.v_Add_Remove_Programs.DisplayName0
于 2013-10-03T20:52:50.147 回答