SQL Server 2005 SP2에 액세스하는 PowerPivot 10.50.1747.0이 설치된 Excel 2010을 실행 중입니다.SQL 테이블의 피벗 테이블 쿼리에서 오류가 발생 함 - 경우에 따라
Excel 피벗 테이블을 수정 중입니다. 쿼리를 통해 SQL 테이블에서 데이터를 가져옵니다. "표 속성"에서 쿼리를 변경하고 있습니다. 새 쿼리를 입력하고 "유효성 검사"버튼을 클릭하면 "SQL 문이 유효합니다."라는 메시지가 나타납니다. "디자인"버튼을 클릭하고 결과 윈도우에서 실행 ("!") 버튼을 클릭하면 적절한 데이터를 얻습니다. 그러나 디자인 창에서 나가서 저장 버튼을 클릭하면 오류가 발생합니다.
==============
The refresh operation failed because the source data base or the table does
not exist, or because you do not have access to the source
More Details:
OLE DB or ODBC error.
An error occurred while processing the 'Query' table.
The operation has been cancelled.
==============
여기 무슨 일이 일어나고 있습니까? (나는 테이블 변수를 사용하고있다 - 문제를 일으키는가?) 어떤 도움을 주셔서 감사합니다.
declare @WCsWithDups TABLE(
WOStatus Char(1) not null,
WOCreated DateTime not null,
WorkOrderNo VarChar(15) not null,
WorkCenterID VarChar(6) not null,
ItemClassID VarChar(12) not null,
StockItem Char(1) not null,
FirstChar Char(1) not null,
MaxWODays SmallInt not null
)
insert into @WCsWithDups(WOStatus, WOCreated, WorkOrderNo, WorkCenterID, ItemClassID, StockItem, FirstChar, MaxWODays)
select DISTINCT
case
when wocompleted is null then 'O'
else 'C' end as WOstatus,
wocreated,
WorkOrderNo,
workcenterid,
itemclassid,
case when timinventory.minstockqty>0 then 'Y'
when timinventory.maxstockqty>0 then 'Y'
when timinventory.safetystockqty>0 then 'Y'
when timinventory.stdordqty>0 then 'Y'
else 'N' end as stockitem,
left(itemproduced,1) as FirstChar,
(select max(datediff(day,wocreated,transdate)+1) from vdvMT b where TR1.workorderno=b.workorderno) as maxwodays
from vdvMT as TR1
left join tInv on TR1.itemkeyproduced=tInv.itemkey and TR1.whsekey=tInv.whsekey
where type='L' and wocreated>=(getdate()-365) and (workcenterid = 'Shed' or workcenterid = 'OP')
delete from @WCsWithDups
where WorkOrderNo in (
select WorkOrderNo from @WCsWithDups group by WorkOrderNo having count(WorkOrderNo) = 1);
select distinct WOStatus, WOCreated, WorkOrderNo, 'Shed+OP' as WorkCenterID, ItemClassID, StockItem, FirstChar, MaxWODays
from @WCsWithDups
오류 메시지 서식에 불이 들어 왔습니다. 르 엉망진창 - 등호의 첫 번째 묶음은 시작 구분 기호로 사용됩니다. 오류는 "... 취소되었습니다."후에 끝납니다. (왜 그 텍스트가 나머지보다 큰지 모르겠다 ...) – Conrad
질문에 생성되는 SQL 코드를 붙여 넣을 수 있습니까? 그것은 정말로 도움이 될 것입니다. – karlgrz
자, 문제 코드를 포함하도록 오리지널 포스트를 편집했습니다. – Conrad