SSRS 无法更新查询的字段列表
SSRS Could not update a list of fields for the query
我正在尝试创建报告,但我的查询似乎导致了问题,尽管它在 Rapid SQL 8.5 上运行良好。具体报错信息如下:
Could not update a list of fields for the query. Verify that you can connect
to the data source and that your query syntax is correct. Invalid column name 'MMTEST%'.
To continue without updating the fields list, click OK
我的查询如下:
select count(*), No.mm_territorynumber as NO,usr.domainname, usr.systemuserid, usr.fullname, usr.mm_PrimaryTeamIdName as PrimaryTeamName
from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid and mm_teamcategorycode is not null
inner join BusinessUnit bu WITH (nolock) on usr.BusinessUnitId = bu.BusinessUnitId
inner join BusinessUnit NO WITH (nolock) on NO.BusinessUnitId = bu.mm_GUID
where usr.systemuserid in (
select usr.systemuserid from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid
and mm_teamcategorycode = '930750004'
where usr.isdisabled = 0
intersect
select usr.systemuserid from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid
and mm_teamcategorycode = '930750000'
where usr.isdisabled = 0
) and
"MMTEST%" not in (select usr.domainname from systemuser usr) and
--usr.domainname not like "MMTEST%" and
usr.systemuserid = team.AdministratorId -- Only team adminstrators
group by No.mm_territorynumber, usr.domainname, usr.systemuserid, usr.fullname, usr.mm_PrimaryTeamIdName
having count(*) = 2
order by NO.mm_territorynumber, usr.fullname;
我已经做了一些研究,以确保我的具体问题尚未得到解答。以下是我访问过的一些链接:
could not create a list of fields for the query
我是否在某处不小心多次选择了某个列?在查看我的代码后,它似乎并非如此,但我对 SQL 也很陌生,所以可能存在一些我不理解的控制流问题。任何帮助将不胜感激。
编辑:似乎 MMTEST% 已创建为一个列,但我不知道为什么会这样。
使用单引号而不是双引号来过滤掉值中的特定单词。
我正在尝试创建报告,但我的查询似乎导致了问题,尽管它在 Rapid SQL 8.5 上运行良好。具体报错信息如下:
Could not update a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct. Invalid column name 'MMTEST%'.
To continue without updating the fields list, click OK
我的查询如下:
select count(*), No.mm_territorynumber as NO,usr.domainname, usr.systemuserid, usr.fullname, usr.mm_PrimaryTeamIdName as PrimaryTeamName
from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid and mm_teamcategorycode is not null
inner join BusinessUnit bu WITH (nolock) on usr.BusinessUnitId = bu.BusinessUnitId
inner join BusinessUnit NO WITH (nolock) on NO.BusinessUnitId = bu.mm_GUID
where usr.systemuserid in (
select usr.systemuserid from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid
and mm_teamcategorycode = '930750004'
where usr.isdisabled = 0
intersect
select usr.systemuserid from systemuser usr WITH (nolock)
inner join dbo.teammembership mem with (nolock) on mem.systemuserid = usr.systemuserid
inner join dbo.team team with (nolock) on team.teamid = mem.teamid
and mm_teamcategorycode = '930750000'
where usr.isdisabled = 0
) and
"MMTEST%" not in (select usr.domainname from systemuser usr) and
--usr.domainname not like "MMTEST%" and
usr.systemuserid = team.AdministratorId -- Only team adminstrators
group by No.mm_territorynumber, usr.domainname, usr.systemuserid, usr.fullname, usr.mm_PrimaryTeamIdName
having count(*) = 2
order by NO.mm_territorynumber, usr.fullname;
我已经做了一些研究,以确保我的具体问题尚未得到解答。以下是我访问过的一些链接:
could not create a list of fields for the query
我是否在某处不小心多次选择了某个列?在查看我的代码后,它似乎并非如此,但我对 SQL 也很陌生,所以可能存在一些我不理解的控制流问题。任何帮助将不胜感激。
编辑:似乎 MMTEST% 已创建为一个列,但我不知道为什么会这样。
使用单引号而不是双引号来过滤掉值中的特定单词。