Csv File Help

  • Hi guys, I am trying to run this package I can't understand this simple package gives me very hard time.

    Source = CSV File

    Destination = OLE DB

    CSV Fields has TEXT Data types and destination has Varchar. I am using "Data Conversion" Transformation to convert TEXT to Varchar Look seems ok, But Every time i run this package package show me RED Color. Please help me out. Please guide me function how i can change data type TEXT TO VARCHAR in 'DERIVED COLUMN"

  • Just Heads up I am getting this error if i use any field.

    "[Flat File Source [14]] Error: The "output column ""COMP_TYPE"" (257)" failed because truncation occurred, and the truncation row disposition on "output column ""COMP_TYPE"" (257)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component."

    Thanks.

  • Right click your Source or Data Conversion (whichever is generating the error) -> Hit Configure Error Output -> Change the setting from Fail Component to Redirect or Ignore Failure depending on what you want to do when it truncates.

    HTH

  • Thanks for your reply,

    1) After i ignore error its work fine but the result come out like this i.e

    "AB"

    "GH"

    "AD"

    Note:- Why "" in my result?

    2) What you think there is any legal way to solve this problem? I don't think ignore error is good solution, what you think?

  • "AB"

    "GH"

    "AD"

    What is wrong with that?

    Can you provide a sample of what your CSV data is like and what form it should be in after?

    Are there no quotations in your source data? What other transformations are applied?

    Ignoring the error isn't necessarily a good solution but it allows you to see what data you are actually getting through.

    Since you are converting from a text stream to a varchar field you are probably going to be truncating at some point.

  • Source data look like this

    AB

    AC

    AD

    I am using

    Source = Flat file source

    Transformation = Data Conversion

    Target = OLE DB

    and i am getting this result (After i use ignore failure)

    "AB"

    "AC"

    "AD"

    Please help me where i am wrong

    Note:- When i check CSV file (Source File) the data look like (AB,AC,AD)

    but in Flat File Source if i hit preview the data I can see the data ("AB","AC","AD")

    Guide me what i am doing wrong. Thanks.

  • I expect that you have quotation marks in the source and your viewer just isn't showing them.

    In the Flat File connecton under generl put quotations in as the text qualifier.

  • Is there any way i can run sql command to delete "Quotations"?

  • After the data has been output to the database?

    I wouldn't recommend trying to do it that way (though maybe someone with stronger SQL could divine a simple way).

    I'd be doing the transformation on the rows while you've got them in the pipeline.

    You can do it with the Dervied Column or with the Script Transform depending on whether you'd rather do it as an expression or as code.

    If you can guarantee that the quotations are always there and always will be you can just take a substring excluding the first and last character.

    But if you want to check for the quotations specifically it's slightly more complicated.

    The more requirements you have (potential length of field, number of columns to apply to, potential for quotations to be missing, extra quotations that might be valid), the more complicated it gets. And it may become more logical to use code for readability and reuse.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply