Sql SCCM如何在此代码中添加计算机名?

Sql SCCM如何在此代码中添加计算机名?,sql,sccm,Sql,Sccm,守则的目的;列出System Center中计算机上的病毒/威胁。但是我不能在这个代码中添加计算机名。这行不通。我们怎样才能做到这一点 Select distinct t.DetectionID, t.DetectionTime, IsNULL(tc.Name,t.ThreatName) as ThreatName, cat.Category, sev.Severity, t.PendingActions, t.Process, t.UserName, t.Path, t.Cleaning

守则的目的;列出System Center中计算机上的病毒/威胁。但是我不能在这个代码中添加计算机名。这行不通。我们怎样才能做到这一点

Select distinct 

t.DetectionID,
t.DetectionTime,
IsNULL(tc.Name,t.ThreatName) as ThreatName, 
cat.Category,
sev.Severity,
t.PendingActions,
t.Process,
t.UserName,
t.Path,
t.CleaningAction,
t.ActionSuccess,
t.DetectionSource

from fn_rbac_R_System(@UserSIDs)  s 
join fn_rbac_GS_Threats(@UserSIDs)  t on s.ResourceID=t.ResourceID
left join fn_rbac_ThreatCatalog(@UserSIDs)  tc on t.ThreatID=tc.ThreatID
left join fn_rbac_ThreatSeverities(@UserSIDs)  sev on tc.SeverityID=sev.SeverityID 
left join fn_rbac_ThreatCategories(@UserSIDs)  cat on tc.CategoryID=cat.CategoryID

where t.DetectionID <> 'Null'

order by t.DetectionTime DESC
选择distinct
t、 检测ID,
t、 检测时间,
作为ThreatName的IsNULL(tc.Name,t.ThreatName),
类别,,
七、严重性,
t、 悬而未决的行动,
t、 过程,
t、 用户名,
t、 路径,
t、 清洁行动,
t、 行动成功,
t、 探测源
来自fn_rbac_R_系统(@UserSIDs)s
在s.ResourceID=t.ResourceID上加入fn_rbac_GS_威胁(@UserSIDs)t
左连接fn_rbac_ThreatCatalog(@UserSIDs)tc on t.ThreatID=tc.ThreatID
左连接fn_rbac_threatSeverity(@UserSIDs)sev on tc.SeverityID=sev.SeverityID
在tc.CategoryID=cat.CategoryID上左连接fn_rbac_ThreatCategories(@UserSIDs)cat
其中t.DetectionID为“Null”
按t.DetectionTime描述订购

与函数fn\u rbac\u R\u System(以及底层视图v\u R\u System)中的fn\u rbac\u GS\u威胁不同,大多数列的名称后面都有一个0,因此您要查找的属性在fn\u rbac\u R\u System中是Name0。(我认为这是因为通常这些视图由不同的数据源组成,并且为了防止多个列使用相同的名称,即使名称已经是唯一的,名称也始终被索引)

因此,在您的示例中,需要:

Select distinct 

s.Name0,
t.DetectionID,
t.DetectionTime,
IsNULL(tc.Name,t.ThreatName) as ThreatName, 
cat.Category,
sev.Severity,
t.PendingActions,
t.Process,
t.UserName,
t.Path,
t.CleaningAction,
t.ActionSuccess,
t.DetectionSource

from fn_rbac_R_System(@UserSIDs)  s 
join fn_rbac_GS_Threats(@UserSIDs)  t on s.ResourceID=t.ResourceID
left join fn_rbac_ThreatCatalog(@UserSIDs)  tc on t.ThreatID=tc.ThreatID
left join fn_rbac_ThreatSeverities(@UserSIDs)  sev on tc.SeverityID=sev.SeverityID 
left join fn_rbac_ThreatCategories(@UserSIDs)  cat on tc.CategoryID=cat.CategoryID

where t.DetectionID <> 'Null'

order by t.DetectionTime DESC
选择distinct
s、 名称0,
t、 检测ID,
t、 检测时间,
作为ThreatName的IsNULL(tc.Name,t.ThreatName),
类别,,
七、严重性,
t、 悬而未决的行动,
t、 过程,
t、 用户名,
t、 路径,
t、 清洁行动,
t、 行动成功,
t、 探测源
来自fn_rbac_R_系统(@UserSIDs)s
在s.ResourceID=t.ResourceID上加入fn_rbac_GS_威胁(@UserSIDs)t
左连接fn_rbac_ThreatCatalog(@UserSIDs)tc on t.ThreatID=tc.ThreatID
左连接fn_rbac_threatSeverity(@UserSIDs)sev on tc.SeverityID=sev.SeverityID
在tc.CategoryID=cat.CategoryID上左连接fn_rbac_ThreatCategories(@UserSIDs)cat
其中t.DetectionID为“Null”
按t.DetectionTime描述订购

与函数fn\u rbac\u R\u System(以及底层视图v\u R\u System)中的fn\u rbac\u GS\u威胁不同,大多数列的名称后面都有一个0,因此您要查找的属性在fn\u rbac\u R\u System中是Name0。(我认为这是因为通常这些视图由不同的数据源组成,并且为了防止多个列使用相同的名称,即使名称已经是唯一的,名称也始终被索引)

因此,在您的示例中,需要:

Select distinct 

s.Name0,
t.DetectionID,
t.DetectionTime,
IsNULL(tc.Name,t.ThreatName) as ThreatName, 
cat.Category,
sev.Severity,
t.PendingActions,
t.Process,
t.UserName,
t.Path,
t.CleaningAction,
t.ActionSuccess,
t.DetectionSource

from fn_rbac_R_System(@UserSIDs)  s 
join fn_rbac_GS_Threats(@UserSIDs)  t on s.ResourceID=t.ResourceID
left join fn_rbac_ThreatCatalog(@UserSIDs)  tc on t.ThreatID=tc.ThreatID
left join fn_rbac_ThreatSeverities(@UserSIDs)  sev on tc.SeverityID=sev.SeverityID 
left join fn_rbac_ThreatCategories(@UserSIDs)  cat on tc.CategoryID=cat.CategoryID

where t.DetectionID <> 'Null'

order by t.DetectionTime DESC
选择distinct
s、 名称0,
t、 检测ID,
t、 检测时间,
作为ThreatName的IsNULL(tc.Name,t.ThreatName),
类别,,
七、严重性,
t、 悬而未决的行动,
t、 过程,
t、 用户名,
t、 路径,
t、 清洁行动,
t、 行动成功,
t、 探测源
来自fn_rbac_R_系统(@UserSIDs)s
在s.ResourceID=t.ResourceID上加入fn_rbac_GS_威胁(@UserSIDs)t
左连接fn_rbac_ThreatCatalog(@UserSIDs)tc on t.ThreatID=tc.ThreatID
左连接fn_rbac_threatSeverity(@UserSIDs)sev on tc.SeverityID=sev.SeverityID
在tc.CategoryID=cat.CategoryID上左连接fn_rbac_ThreatCategories(@UserSIDs)cat
其中t.DetectionID为“Null”
按t.DetectionTime描述订购

您遇到的错误是什么?通常情况下,它会出现在一个collumn s.Name0中,在你的例子中,我看不出:)非常感谢。太好了,那么我将重写它作为一个答案,这样这个问题就不会出现没有答案的情况。你可以这样做。:)您得到的错误是什么?通常情况下,它会出现在一个collumn s.Name0中,在你的例子中,我看不出:)非常感谢。太好了,那么我将重写它作为一个答案,这样这个问题就不会出现没有答案的情况。你可以这样做。:)