脚本组件失败:System.IndexOutOfRangeException:索引超出了数组的范围

问题描述 投票:0回答:4

在SSIS包中,“脚本组件”由于以下异常而失败。此例外有时仅发生。这个脚本组件包含Try / Catch,但它仍然失败。这个例外的原因是什么?

错误信息


5246793 User:OnError Package1 2015-01-16 03:40:45.000 2015-01-16 03:40:45.000 00:00:00 System.IndexOutOfRangeException: Index was outside the bounds of the array.

   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)

   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)

   at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper100 wrapper, Int32 inputID, IDTSBuffer100 pDTSBuffer, IntPtr bufferWirePacket)

5246800 OnError Package1 2015-01-16 03:40:45.000 2015-01-16 03:40:45.000 00:00:00 SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Script Component" (657) failed with error code 0x80131508 while processing input

input "Input 0" (666). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
sql-server-2008 ssis business-intelligence script-component msbi
4个回答
2
投票

该错误与脚本任务的输入列有关,您可以在脚本转换编辑器的第二个选项卡上找到该列。也许它期望一个不再存在的列,或者您正在使用未被选中的脚本中的列。

如果仍然无法识别问题,请尝试刷新组件的元数据,或删除它并重新创建它。


0
投票

在som ETL数据流中存在同样的问题:同一脚本任务的多个实例有时工作,有时不工作,在管道缓冲区上显示相同的“索引越界”错误。解决方法是删除从现有实例复制的实例并从头开始生成新任务,只需复制脚本本身即可。复制这些东西时可能会出现问题,越过缓冲区?希望能帮助到你...


0
投票

@Oliver的回答是最接近真相的。这一步确实可以解决问题,我也经历过这个问题。我们心爱的Stack Overflow的典型代表,正确答案的零评级。

当脚本组件尝试访问Dts.Variables集合时,您也可以间歇性地从SSIS中获取此内容,但是在脚本的“ReadOnlyVariables”或“ReadWriteVariables”参数中未选择该变量。检查使用的索引是否正确并且格式正确,例如

用户:: VARIABLENAME


0
投票

复制对我来说是个问题。就我而言,我有超过50个输出列,因此重新创建脚本组件不是一个好选择。我最终在VSCODE中打开了DTSX文件(在右侧滚动条上有很棒的突出显示)。每个组件的GUID /程序集名称将被阻止为每个组件出现18次。因此,对于副本,我有36次出现相同的GUID。它们足够分离以识别每个组件,只是创建了一个新的guid,并替换了其中一个组件,并解决了错误。希望这有助于某人。

© www.soinside.com 2019 - 2024. All rights reserved.