0
votes

Get substring of a string in ssis script component throw error:

Index and length must refer to a location within the string. Parameter name: length

at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at ScriptMain.Input0_ProcessInputRow(Input0Buffer Row) at UserComponent.Input0_ProcessInput(Input0Buffer Buffer) at UserComponent.ProcessInput(Int32 InputID, PipelineBuffer Buffer) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)

Code:

 public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    Row.ORGANISATIONPROVIDERSOURCEIDOut = Row.ORGANISATIONPROVIDERSOURCEID.Substring(0,19);
    Row.ORGANISATIONPROVIDERIDOut = Row.ORGANISATIONPROVIDERID;
}

any help please.

thanks

1

1 Answers

0
votes

That error means your ORGANISATIONPROVIDERSOURCEID string is less than 19 characters. The SubString function's second parameter (length) cannot be greater than the length of the text.