3

when i try to pass DateTime.Now value to DT_DBTIMESTAMP field via this code

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
    Output0Buffer.AddRow();
    Output0Buffer.Dt = DateTime.Now;
}

it works well. but when Output0Buffer.Dt is of type DT_DBTIMESTAMP2, i receive a message:

"The value is too large to fit in the column data area of the buffer."

screenshot

though DT_DBTIMESTAMP2 should be larger than DT_DBTIMESTAMP

is there a way to pass the value properly?

Hadi
  • 36,233
  • 13
  • 65
  • 124
iliyesku
  • 361
  • 2
  • 10

2 Answers2

3

scale parameter is set to 0 by default

in my case it should be 7

enter image description here

iliyesku
  • 361
  • 2
  • 10
2

after searching i found this article: Mapping C# DateTime to SQL Server datetime2 via SSIS, ithink this is what you are looking for.

Also you can do a workaround

Don't change the output column type, leave it DT_DBTIMESTAMP.

And outside the script component, Add a Data Conversion Transformation and convert the output column to DT_DBTIMESTAMP2

Hadi
  • 36,233
  • 13
  • 65
  • 124