对不起,如果这是一个小问题的一点,但我并不是所有的善良与VB,我一直在搜索我的问题,整个星期没有找到解决方案。SSIS Excel写入变量写入0行
我试图从SQL Server 2008导出每周数据提取到使用SSIS的Excel工作簿中的新(可变名称)工作表。
我目前的设置是一个脚本任务,它定义了要写入的Excel表名,然后是ODBC - > Excel传输。
这是我的脚本任务(每次都会调试);
Public Sub Main()
Dim vars As Variables
Dts.VariableDispenser.LockOneForWrite("SheetName", vars)
vars(0).Value = "Week_" & DatePart(DateInterval.WeekOfYear, Today())
vars.Unlock()
Dts.TaskResult = ScriptResults.Success
End Sub
我已将我的用户变量SheetName设置为Package的范围,并将Value设置为WeekNew。
我有包在32位运行。 我已经为容器的全部内容设置了延迟验证为True。
昨天我在调试日志中收到了这些错误消息;
Error: 0xC0202009 at Create Data Extract, Create Extract [804]:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
Error: 0xC02020E8 at Create Data Extract, Create DQ Extract [804]:
Opening a rowset for "Week_30" failed. Check that the object exists in the database.
Error: 0xC004701A at Create Data Extract, SSIS.Pipeline: component "Create Extract" (804) failed the pre-execute phase and returned error code 0xC02020E8.
我不记得我昨天变了,但现在当它到达出口我从调试日志下面的Excel目标的一部分;
Error: 0xC0202009 at Create Data Extract, Excel Destination [1045]: SSIS Error Code
DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
Error: 0xC02020E8 at Create Data Extract, Excel Destination [1045]: Opening a rowset for "Week_30" failed. Check that the object exists in the database.
Error: 0xC004701A at Create Data Extract, SSIS.Pipeline: component "Excel Destination" (1045) failed the pre-execute phase and returned error code 0xC02020E8.
我真的不知道该怎么做才能解决这个问题,它开始让我疯狂。任何人都可以提供的建议会很棒,我现在已经超出了我的深度!
编辑:我已经尝试在excel文件中创建destiation并写入,但它仍然写入0行。
编辑:按照TMNT2014发布的教程,我收到以下错误消息;
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 1 to variable "User::WeekKey" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 8 to variable "User::Ref_Number" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 9 to variable "User::Ref_Number_2" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 10 to variable "User::Ref_Number3" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 11 to variable "User::Ref_Number4" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 13 to variable "User::Status1" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 14 to variable "User::Status2" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 22 to variable "User::Region" cannot be applied.
Error: 0xC001C012 at Foreach Loop Container: ForEach Variable Mapping number 45 to variable "User::Date" cannot be applied.
我的数据集中有45个字段,这些是我得到的唯一错误,没有其他信息。我在网上查过,并没有发现任何其他人只是得到了变量映射错误(它总是与其他东西一起),没有人使用Rafael的示例数据来解决这个问题。我只能假设这与我的数据的源格式有关。
我有所有45个变量设置为字符串,创建表语句创建每个字段作为Varchar,我有一个数据从Unicode字符串转换为非Unicode字符串在导出(因为否则它转换失败)。有任何想法吗?
所以基本上你有正确设置Excel工作表名称的变量名称,但它实际上并没有在目标文件存在。因此,错误,你需要在目的地创建表(表)。这是我在Google上搜索时发现的内容 - http://www.rafael-salas.com/2006/12/import-header-line-tables-_116683388696570741.html。希望这可以帮助。 – TMNT2014
我已经尝试制作目标表单,对不起,我忘了提及这一点。当我在文件中有目标工作表时,它仍然写入0行。我正在查看链接,这可能会工作:)谢谢,我会让你知道如果它! – TaniaJ
对不起,除非我做错了,否则它不适用于excel文件中的工作表,它适用于excel工作簿。 – TaniaJ