我意识到这可能是一个不寻常的要求。我正在尝试创建合规报告。
需要更改以下查询以验证某些返回的项目。返回的值将是兼容的,不合规的(显示版本3)或丢失。我尝试使用case语句但是如果项目丢失则不返回任何内容。
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
逻辑
返回X和Y的值。如果项目是否合规则返回(X = Y或X!= Y)
示例解决方案
Kevin要求的逻辑
如果X = Y,则标记为符合,如果Y缺失则标记为缺失且不符合,如果Y版本错误则返回该值并标记为不符合
返回X和Y的值。如果项目是否合规则返回(X = Y或X!= Y)
示例解决方案报告
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
答案 0 :(得分: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