Flat file destination columns data types validation

后端 未结 2 1477
無奈伤痛
無奈伤痛 2021-01-14 17:39

A source database field of type INT is read through an OLE DB Source. It is eventually written to a Flat File Destination. The destination Flat File Connection Manager > Adv

2条回答
  •  抹茶落季
    2021-01-14 18:38

    Data types validation

    I think this issue is related to the connection manager that is used, since the data type validation (outside the pipeline) is not done by Integration services, it is done by the service provider:

    • OLEDB for Excel and Access
    • SQL Database Engine for SQL Server
    • ...

    When it comes to flat file connection manager, it doesn't guarantee any data types consistency since all values are stored as text. As example try adding a flat file connection manager and select a text file that contains names, try changing the columns data types to Date and go to the Columns preview tab, it will show all columns without any issue. It only take care of the Row Delimiter, column delimiter , text qualifier and common properties used to read from a flat file. (similar to TextFieldParser class in VB.NET)

    The only case that data types may cause an exception is when you are using a Flat file source because the Flat file source will create an External columns with defined metadata in the Flat file connection manager and link them to the original columns (you can see that when you open the Advanced editor of the Flat file source) when SSIS try reading from flat file source the External columns will throw the exception.

    Binary output

    You should convert the column into binary within the package and map it to the destination column. As example you can use a script component to do that:

    public override void myInput_ProcessInputRow(myInputBuffer Row)
      {
    
      Row.ByteValues=System.Text.Encoding.UTF8.GetBytes (Row.name);
    
      }
    

    I haven't try if this will work with a Derived column or Data conversion transformation.

    References

    • Converting Input to (DT_BYTES,20)
    • DT Bytes in SSIS

提交回复
热议问题