枢轴在 SSIS 中不起作用
pivot not working in SSIS
我的 SQL 查询在 SQL management studio 中执行时工作正常,但在 SSIS 包中执行时抛出以下错误。有什么建议吗?
**单击语法的构建查询时 - 它显示
The PIVOT SQL construct or statement is not supported.
Case 1:
SELECT listid,
[1]
FROM (SELECT listid,
val,
[order]
FROM gmt_listsvals) P
PIVOT (Max (val)
FOR [order] IN ([1])) AS pvt
案例 2:
SELECT comb_id, [orgunit], [time], [gender], [jobcategory], [ethnicity], [gradegroup], [regiongeo], [emplclass], operatorid, seq_id, sequance_name, listid
FROM (SELECT C.comb_id, dim_name, V.operatorid,V.seq_id, V.listid, dim_value, S.sequance_name
FROM gmt_combinationsflat C
JOIN gmt_valuesflat V ON C.comb_id = V.comb_id
JOIN gmt_rangeseq S ON V.seq_id = S.seq_id
JOIN gmt_dimensions D ON C.dim_id = D.dim_id
WHERE C.kpi_id = 9 AND C.last = 1) P
PIVOT (Max(dim_value) FOR dim_name IN ( [ORGUNIT ], [Time ], [Gender ], [JobCategory ], [Ethnicity ], [GradeGroup ], [RegionGeo ], [EmplClass ] ) ) AS pvtt
错误
Exception from HRESULT: 0xC0202009 Error at ..: SSIS Error Code
DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:
0x80040E21. An OLE DB record is available. Source: "Microsoft SQL
Server Native Client 11.0" Hresult: 0x80040E21 Description:
"Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.".
该语句等同于:
select listid, max(case when [order] = 1 then val end) as [1]
from gmt_listsvals
group by listid
我的 SQL 查询在 SQL management studio 中执行时工作正常,但在 SSIS 包中执行时抛出以下错误。有什么建议吗?
**单击语法的构建查询时 - 它显示
The PIVOT SQL construct or statement is not supported.
Case 1:
SELECT listid,
[1]
FROM (SELECT listid,
val,
[order]
FROM gmt_listsvals) P
PIVOT (Max (val)
FOR [order] IN ([1])) AS pvt
案例 2:
SELECT comb_id, [orgunit], [time], [gender], [jobcategory], [ethnicity], [gradegroup], [regiongeo], [emplclass], operatorid, seq_id, sequance_name, listid
FROM (SELECT C.comb_id, dim_name, V.operatorid,V.seq_id, V.listid, dim_value, S.sequance_name
FROM gmt_combinationsflat C
JOIN gmt_valuesflat V ON C.comb_id = V.comb_id
JOIN gmt_rangeseq S ON V.seq_id = S.seq_id
JOIN gmt_dimensions D ON C.dim_id = D.dim_id
WHERE C.kpi_id = 9 AND C.last = 1) P
PIVOT (Max(dim_value) FOR dim_name IN ( [ORGUNIT ], [Time ], [Gender ], [JobCategory ], [Ethnicity ], [GradeGroup ], [RegionGeo ], [EmplClass ] ) ) AS pvtt
错误
Exception from HRESULT: 0xC0202009 Error at ..: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
该语句等同于:
select listid, max(case when [order] = 1 then val end) as [1]
from gmt_listsvals
group by listid