Koen Verbeeck (7/29/2014)
Is it possible to post the .NET code?
Sure! Though note that the DataFLow task fails just before this code begins to execute:
/* Microsoft SQL Server Integration Services Script Component
* Write scripts using Microsoft Visual C# 2008.
* ScriptMain is the entry point class of the script.*/
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
public override void PreExecute()
{
base.PreExecute();
/*
Add your code here for preprocessing or remove if not needed
*/
}
public override void PostExecute()
{
base.PostExecute();
/*
Add your code here for postprocessing or remove if not needed
You can set read/write variables here, for example:
Variables.MyIntVar = 100
*/
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
const int MinExpectedNumberOfFields = 2;
const int MaxExpectedNumberOfFields = 3;
string[] values = Row.Data.Split(new char[] { '\t' }, MaxExpectedNumberOfFields);
// Check that correct number of values received
if (values.Length < MinExpectedNumberOfFields || values.Length > MaxExpectedNumberOfFields)
{
bool pbCancel = false;
this.ComponentMetaData.FireError(100,
"Process Detail Row",
String.Format("Incorrect number of fields. Expected: {0} to {1}, received: {2}",
MinExpectedNumberOfFields,
MaxExpectedNumberOfFields,
values.Length),
"No Help Available", 0, out pbCancel);
return;
}
Row.ErrorCode = values[0];
Row.ErrorMessage = values[1];
Row.LoggingActivityRecord = values.Length >= 3 ? values[2] : null;
}
}