-1

在此处输入图像描述

以下查询在 SQL Management Studio 和 Altiris 中运行良好。当我们尝试将代码添加到用 C# 编写的自定义报告工具时,我们会收到上述错误。

Declare @AcroPro        int
Declare @AcroStan       int

set @AcroPro = (select COUNT(distinct guid) from vAdobe_Acrobat_Pro where [Display Name] like '%Professional')
set @AcroStan = (select COUNT(distinct guid) from vAdobe_Acrobat_Stan where [Display Name] like '%Standard')

select distinct v2.name 'Software Product', t2.[Purchased Licenses], CASE 

      When t2._resourceguid = '8708D8B8-51A0-4386-B4A1-620CC63DEF0D'
      Then @AcroPro
      When t2._resourceguid = '37997FB9-9936-42CF-A34C-D68214C353CF'
      Then @AcroStan
      End [Active Licenses], CASE 

      When t2._resourceguid = '8708D8B8-51A0-4386-B4A1-620CC63DEF0D'
      Then t2.[purchased licenses] - @AcroPro
      When t2._resourceguid = '37997FB9-9936-42CF-A34C-D68214C353CF'
      Then t2.[purchased licenses] -@AcroStan
      End [Compliance] from vComputer v1

inner join Inv_SoftwareProduct_InstallationInfo t1 on v1.Guid = t1._computerResourceGuid
inner join Inv_SoftwareProduct_ComplianceInfo t2 on t1._ResourceGuid = t2._ResourceGuid
inner join vSoftwareProduct v2 on t2._ResourceGuid = v2.guid

where v2.name in ('Adobe Acrobat Professional', 'Adobe Acrobat Standard')

and v1.IsManaged = '1'
4

1 回答 1

2

您的报告工具可能会在同一个查询批次中两次发送相同的 SQL 命令集,在这种情况下,这些变量将被重新声明。

于 2016-07-15T17:13:48.827 回答