My current package consists of an Excel Source, a Script component, and an OLE DB destination. All I am trying to accomplish is to transform one of my columns. For this specific column I want a substring of the column. However, I keep getting the following error message:
There is no current row in the buffer. A row may need to be added using the AddRow method.
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
What does that mean? Why would I need to Add Rows when all I am doing is transforming data? Am I missing the big picture about SSIS?
Here is my code in the script:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
OutBuffer.labortypewbs = Row.CopyofLevel2ProjectSegment.Substring(Row.CopyofLevel2ProjectSegment.Length - 2, 2);
}
Thanks for all the help!
Why don’t you use a derived column rather than a script component. You can add a column that is a substring of an existing column trivially with that component, and you don’t have to write any code or learn the intricacies of script component programming. I would only use a script component if:
I have had a few edge cases where a script component was the best solution, but they are few and far between, and a substring is not one of those cases.