0

SQL Server 2008 を使用しており、Excel にエクスポートしようとしています。エクスポート ウィザードを使用してこれを正常に実行しましたが、実行可能なクエリを使用してこれを実行しようとしています。これが私が使用しようとしているコードです:

    EXEC sp_configure 'show advanced options', 1;

    GO

    RECONFIGURE;

    GO

    EXEC sp_configure 'Ad Hoc Distributed Queries', 1;

    GO

    RECONFIGURE;

    GO




    USE [RolandTest]

    INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=c:\Users\Roland\Desktop\ExcelExportsPractice\EEPractice.xlsx;','Select * from [GasEUR$]')
    SELECT     rcl.CaseCaseId AS CaseId, cc.Label AS CaseName, cc.Field, cc.Reservoir, cc.County, cc.State, cc.OperatorName, cc.BaseApiCode, cc.Location, cc.CaseType, 
                  rcat.Label AS Category, rclass.Label AS Class, ps.ReportDate, cs.CaseDiscountFactor, corp.Label AS Scenario, cct.Label AS CorpCaseType, cp.Label AS MajorPhase, 
                  rcl.SortId, ProjProject.Label AS Project
    FROM         PhdRpt.ReportCaseList_465 AS rcl INNER JOIN
                  CaseCases AS cc ON rcl.CaseCaseId = cc.CaseCaseId INNER JOIN
                  Corp.RsvCategory AS rcat ON cc.RsvCatSortNumber = rcat.RsvCatSortNumber INNER JOIN
                  Corp.RsvClass AS rclass ON cc.RsvClassSortNumber = rclass.RsvClassSortNumber INNER JOIN
                  CaseScenario AS cs ON cc.CaseCaseId = cs.CaseCaseId AND cc.CaseCaseId = cs.CaseCaseId AND cc.CaseCaseId = cs.CaseCaseId AND 
                  cc.CaseCaseId = cs.CaseCaseId INNER JOIN
                  ProjectScenario AS ps ON cs.ProjProjectId = ps.ProjProjectId AND cs.CorpScenarioId = ps.CorpScenarioId AND cs.ProjProjectId = ps.ProjProjectId AND 
                  cs.CorpScenarioId = ps.CorpScenarioId AND cs.ProjProjectId = ps.ProjProjectId AND cs.CorpScenarioId = ps.CorpScenarioId AND 
                  cs.ProjProjectId = ps.ProjProjectId AND cs.CorpScenarioId = ps.CorpScenarioId AND cs.ProjProjectId = ps.ProjProjectId AND 
                  cs.CorpScenarioId = ps.CorpScenarioId AND cs.ProjProjectId = ps.ProjProjectId AND cs.CorpScenarioId = ps.CorpScenarioId INNER JOIN
                  CorpScenario AS corp ON ps.CorpScenarioId = corp.CorpScenarioId INNER JOIN
                  CorpCaseType AS cct ON cc.CaseType = cct.CorpCaseTypeId INNER JOIN
                  ModelPhaseConfiguration AS mpc ON cs.ModelPhaseConfigurationId = mpc.ModelPhaseConfigurationId INNER JOIN
                  CorpProduct AS cp ON mpc.MajorPhaseId = cp.CorpProductId INNER JOIN
                  ProjProject ON ps.ProjProjectId = ProjProject.ProjProjectId
    WHERE     (cs.CorpScenarioId = 1) AND (cs.Deleted = 0)
    GROUP BY rcl.CaseCaseId, cc.Label, cc.Field, cc.Reservoir, cc.County, cc.State, cc.OperatorName, cc.BaseApiCode, cc.Location, cc.CaseType, rcat.Label, rclass.Label, 
                  ps.ReportDate, cs.CaseDiscountFactor, corp.Label, cct.Label, cp.Label, rcl.SortId, ProjProject.Label
    ORDER BY rcl.SortId, CaseId

これを実行しようとすると、次のエラーが発生します。

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Unspecified error".

Msg 7303, Level 16, State 1, Line 3 Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

私がこれに間違った方法でアプローチしている場合、誰かが私に知らせてもらえますか? 提案やコメントをお待ちしております。ご協力ありがとうございました。

4

0 に答える 0