0

嗨,我正在开发一个 ssis 包,该包将 excel 文件 (.xlsx) 从 ftp 服务器导入到本地文件夹,然后将它们导入到 sql server 表中。我正在使用foreach文件名的映射。从 ftp 服务器导入到本地工作正常,但是从本地文件夹导入到 sql 表失败​​。

看来我的excel源代码有问题。这些是错误:

Start SSIS package "Package.dtsx."
Information: 0x1 at Script Task, C # My Message: System.Collections.ArrayList
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase begins.
Error: 0xC0202009 at Data Flow Task, Excel Source [1]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
Error: 0xC02020E8 to Flow Task data, Excel Source [1]: Failed to open a rowset for "Sheet1 $". Verify that the object exists in the database.
Error: 0xC004706B to Flow Task data SSIS.Pipeline: validation failed "component" Excel Source "(1)". Returned validation status "VS_ISBROKEN."
Error: 0xC004700C to Flow Task data SSIS.Pipeline: Failed to validate one or more components.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation.
Warning: 0x80019002 at Foreach Loop Container: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors (6) reached the maximum allowed (1); leading to a failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the value of MaximumErrorCount or fix the errors.
SSIS package "Package.dtsx" finished: Success.
The program '[5504] Package.dtsx: DTS' has exited with code 0 (0x0).

作为配置,我有:

对于 excel 管理器连接,我为 connectionString =@[User::variable1] + @[User::DOWNLOAD_DIRECTORY_LOCAL] + @[User::FTP_FILE_URL] + @[User::variable2]

variable 1 =Provider=Microsoft.ACE.OLEDB.12.0;Data Source=

variable 2 = ;Extended Properties="EXCEL 12.0;HDR=YES";

我还将数据流任务、ftp 任务、foreach 任务和 excel 连接的延迟验证属性设置为 true。

4

2 回答 2

1

我刚刚写了一个包来自己做同样的事情。按此顺序检查的事项:

  1. 在您的 Excel 数据连接中,您是否浏览到本地文件夹中的 excel 文件(一旦它们在那里)并选择了一个(您需要在开发时复制一个)?因此,当您转到数据流任务(在 For Each 内)中的 excel 源对象时,您可以选择 Excel 数据连接,然后在“excel 表的名称”下查看 Sheet$1?

  2. 一旦您确定您已完成上述操作,您是否右键单击 Excel 数据连接并在表达式属性中添加 ExcelFilePath = @[User::FTP_FILE_URL]?(请注意,您需要在 For Each 容器的 Collection 选项卡上的 Retrieve File Name 下选择“Fully Qualified”)

  3. 在您的 Excel 数据连接中,您是否为 .xlsx 文件选择了正确的版本 (Excel 2007) 或为 .xls 选择了 Excel 2003?我注意到一个小错误,当我将默认文件名更改回 2007 时,我不得不手动将其(再次)更改回 2003。

  4. 在步骤运行之前检查文件夹中至少存在一个工作簿。这里有一些关于如何添加脚本任务来验证 User::DOWNLOAD_DIRECTORY_LOCAL 中的至少一个文件的代码。

  5. 我收到了大量有关 Microsoft.ACE.OLEDB.12.0 驱动程序的错误,另外还有 64 位服务器的问题,必须将包包装在作业中并检查执行选项下的“使用 32 位运行时”选项在工作属性中。检查驱动程序是否正常工作(尽管如果您没有正确设置它通常会给出特定的驱动程序错误)。

嗯,在我回家之前很快就这样了。让我知道它是否有效或仍然失败..

于 2013-04-09T06:10:49.757 回答
1

遇到此问题时您应该问自己的问题是:
我从哪里运行我的 dstx 文件?
它来自 Microsoft Visual Studio 吗?
它来自 SQL 代理吗?
它来自集成服务包执行实用程序吗?
然后细化您的问题以在论坛上找到答案。

于 2015-09-14T07:48:43.090 回答