SSIS 数据流任务单独运行,但不作为包的一部分运行 [英] SSIS Data flow task runs by itself but not as part of package
问题描述
我有一个 dtsx 包,其中包含一堆数据流.
I have a dtsx package which contains a bunch of data flows.
它们都从表中选择行,每一行都包含一个带有一些 JSON 的列,有一个反序列化 JSON 的脚本组件 (C#),然后是一个将数据加载到一些缓冲区表的数据目标.
All of them select rows from table, each of the rows contains a column with some JSON, there is a script component (C#) which deserializes the JSON, then a data destination which loads the data up to some buffer tables.
处理一些非常简单的 JSON 的最简单的脚本之一可以完美运行(右键单击 -> 执行任务,或禁用所有其他任务时),但是当我尝试将包作为一个整体运行时,这个包因错误消息而失败
One of the most simple scripts which deals with some really simple JSON runs perfectly by itself (Right click -> Execute Task, or when all other tasks are disabled), however when I try to run the package as a whole this package falls over with the error message
索引超出数组范围.在 ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)在 UserComponent.Input0_ProcessInput(Input0Buffer Buffer)在 UserComponent.ProcessInput(Int32 InputID, String InputName, PipelineBuffer Buffer, OutputNameMap OutputMap)在 Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.ProcessInput(Int32 InputID, PipelineBuffer buffer)在 Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
Index was outside the bounds of the array. at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) at UserComponent.Input0_ProcessInput(Input0Buffer Buffer) at UserComponent.ProcessInput(Int32 InputID, String InputName, PipelineBuffer Buffer, OutputNameMap OutputMap) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponent.ProcessInput(Int32 InputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)
JSON 看起来像这样...
The JSON looks like this...
{
"token": "0b683877-81d6-4dhs-a1ad-9fcfff6acb61",
"email": "someone@gmail.com"
}
和像这样的c#
public class RootAttributes
{
public string token { get; set; }
public string email { get; set; }
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
String myEvtData = System.Text.Encoding.Unicode.GetString(Row.evtdata.GetBlobData(0, Convert.ToInt32(Row.evtdata.Length)));
JavaScriptSerializer js = new JavaScriptSerializer();
RootAttributes jRow = js.Deserialize<RootAttributes>(myEvtData);
//DB Output
Output0Buffer.AddRow();
Output0Buffer.country = Row.country;
Output0Buffer.ord = Row.ord;
Output0Buffer.aggregateversion = Row.aggregateversion;
Output0Buffer.clienttype = Row.clienttype;
Output0Buffer.aggregateid = Row.aggregateid;
Output0Buffer.updby = Row.updby;
Output0Buffer.evttimestamp = Row.evttimestamp;
//JSON Output
Output0Buffer.token = jRow.token;
Output0Buffer.email = jRow.email;
}
我有第二个脚本 - 几乎完全相同,它也失败并显示相同的错误消息.我尝试过一个接一个地独立运行它们 - 即一次运行所有 DF.
I have a second script - virtually identical which also fails with the same error message. I have tried running them both one after the other and independently - i.e. all DFs at once.
请帮忙
谢谢
迈克
推荐答案
归根结底,这是因为将数据流任务从一个包复制到另一个包.我不是 100% 确定原因是什么,但复制并不完美,而且 DF 似乎相互感染.
Ultimately this was due to copying Data Flow tasks from one package to another. I am not 100% sure what the cause is, but copying wasn't perfect and the DFs seemed to be infecting each other.
我在这里找到了解决方案
I found the solution here
https://kohera.be/blog/sql-server/the-dangers-of-copying-script-components-in-ssis/
这篇关于SSIS 数据流任务单独运行,但不作为包的一部分运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!