derived task or data conversion task

  • I have a data flow task, the source is a flat text file. The destination is a sql database table

    In the flat source file, i have a column that may have more than 30 characters and trailing space at end, the database table column is varchar(30).

    If I will have to import only the first 30 characters into the table.

    What is the difference in cases I use the following two methods:

    a. use a derived task : something like this: (DT_STR,30,1252)(SUBSTRING([CostCtr ],1,30))

    b. use a data conversion task: just convert it use string[DT_STR] and Length 30.

    Currently I'm using a, but not sure b is an easier version and also works correctly.

    Does b method work as the same as only get the first 30 characters?

  • You'll have to make sure your errors are set to ignore truncation, otherwise execution of the package will stop, but I think that should work.

    ---------------------------------------------------------
    How best to post your question[/url]
    How to post performance problems[/url]
    Tally Table:What it is and how it replaces a loop[/url]

    "stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."

  • I think option a is better from a maintenance point of view. It is easier for the guy/girl after to figure out what is going on if you are literally chopping off a piece of the string using a derived column. With the conversion component, it is quite hidden in the error configuration.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks all.

Viewing 4 posts - 1 through 4 (of 4 total)

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