我正在尝试构建一个查询,在该查询中我可以在我的环境中清点SQL实例。我想我的代码中可能会略微偏离。当我执行查询时,它会在几秒钟内返回,但没有结果。任何帮助将不胜感激:
SELECT DISTINCT s.name0 AS [Server Name],
os.caption0 AS [Operating System],
cpu.name0 AS [Chipset],
c.model0 AS [Hardware or Platform],
Count(cpu.resourceid) AS [Number of CPUs],
cpu.numberofcores0 AS [Number of Cores per CPU],
cpu.numberoflogicalprocessors0 AS [Logical Processor Count]
FROM v_gs_computer_system c
FULL OUTER JOIN v_r_system s
ON s.resourceid = c.resourceid
FULL OUTER JOIN v_gs_operating_system os
ON c.resourceid = os.resourceid
FULL OUTER JOIN v_gs_processor cpu
ON c.resourceid = cpu.resourceid
FULL OUTER JOIN v_gs_installed_software gis1
ON gis1.resourceid = cpu.resourceid
WHERE s.active0 = 1
AND s.client0 = 1
AND s.distinguished_name0 LIKE '%server%'
AND gis1.publisher0 LIKE '%microsoft%'
AND gis1.productname0 LIKE '%sql server%'
AND gis1.installsource0 LIKE '%standard%'
AND gis1.installsource0 LIKE '%Enterprise%'
GROUP BY s.name0,
os.caption0,
cpu.name0,
c.model0,
cpu.numberoflogicalprocessors0,
cpu.numberofcores0
答案 0 :(得分:0)
我认为这是一个SCCM数据库查询。
考虑此查询SELECT * FROM v_GS_INSTALLED_SOFTWARE
那张桌子对我来说是空的。 v_HS_INSTALLED_SOFTWARE
也是如此。我不知道为什么这些在数据库中,但我建议使用v_Add_Remove_Programs
并将ProductName0
更改为DisplayName0
。
另外,您在WHERE
声明中的最后一个条款:
and gis1.InstallSource0 like '%standard%'
and gis1.InstallSource0 like '%Enterprise%'
这两者都是真的吗?不管怎样,请考虑这一点(见下文):
and (gis1.InstallSource0 like '%standard%'
OR gis1.InstallSource0 like '%Enterprise%')
但是,这些列不在此表中。不幸的是,我不知道如何判断它是否是SQL企业版的标准。