用于将SQL Server表导出到Excel 2010的脚本或SQL查询

时间:2015-01-16 01:00:58

标签: excel sql-server-2008 sql-server-2005

我必须从大约5个数据库中提取数据到excel 2010.每个数据库有大约300个表。我希望每个表都是1个表。所以我将在一个excel文件中有大约300张纸。我将有8个excel文件。

我尝试了查询但最终出现了错误:

查询:

insert into OPENROWSET('Microsoft.ACE.OLEDB.12.0', 
'Excel 12.0;Database=C:\ExcelExport\testing.xlsx;', 
'SELECT * FROM [Sheet1$]') 
select * from dbo.GET

错误:

 OLE DB error trace [Non-interface error:  Provider not registered.].
 Msg 7403, Level 16, State 1, Line 1
Could not locate registry entry for OLE DB provider 'Microsoft.ACE.OLEDB.12.0'.

注意:我提到这是为了得到连接字符串; http://www.connectionstrings.com/excel-2010/

我怎样才能重新获得这个?

然后,我尝试使用improt导出向导。但是,我遇到了错误。

Operation stopped...

 - Initializing Data Flow Task (Success)

 - Initializing Connections (Success)

- Setting SQL Command (Success)

 - Setting Source Connection (Success)

  - Setting Destination Connection (Success)

 - Validating (Success)

 - Prepare for Execute (Success)

 - Pre-execute (Error)
Messages
* Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR.  An OLE       DB error has occurred. Error code: 0x80040E21.
 (SQL Server Import and Export Wizard)

* Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
 (SQL Server Import and Export Wizard)

* Error 0xc004701a: Data Flow Task 1: component "Destination - ACCOUNT" (145)      failed the pre-execute phase and returned error code 0xC0202025.
 (SQL Server Import and Export Wizard)


  - Copying Rows (Warning)
Messages
* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)

* Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)


 - Post-execute (Stopped)
Messages
* Information 0x4004300b: Data Flow Task 1: "component "Destination - ACCOUNT" (145)" wrote 0 rows.
 (SQL Server Import and Export Wizard)

* Information 0x4004300b: Data Flow Task 1: "component "Destination 1 - ACCOUNTADDR" (426)" wrote 0 rows.
 (SQL Server Import and Export Wizard)

* Information 0x4004300b: Data Flow Task 1: "component "Destination 2 - ACCOUNTASSO" (547)" wrote 0 rows.
 (SQL Server Import and Export Wizard)

* Information 0x4004300b: Data Flow Task 1: "component "Destination 3 - ACCOUNTCON" (653)" wrote 0 rows.
 (SQL Server Import and Export Wizard)

* Information 0x4004300b: Data Flow Task 1: "component "Destination 4 - ACCOUNTTYPE" (752)" wrote 0 rows.

我希望一次将所有数据导出到一个excel文件中 我该如何解决这个问题?请帮忙。

0 个答案:

没有答案