Import string to float error in .csv file

  • Hi all:

    I do not have a lot of experience with DTS and would appreciate some help.  I am having a problem importing a comma delimited file into a table using DTS. The error I get is:

    “The number of failing rows exceeds the maximum specified.

    Transform copy “DirectCopyXForm’ conversion error: Conversion invalid for datatypes on column pair 9(source column ‘F1’(DBTYPE_STR), destination column ‘F1’ (DBTYPE_R8)).

    Source column 9 (‘F1’) is from an Excel .csv file and looks something like this:

    3494803.7

    3494803.7

    The column was designated as a general text column in Excel.

    Destination column ‘F1 is designated as a float.

    In the sql server documentation I do not see any requirement to do a convert from string to float in the conversion table.

    Can someone give a clue? Thanks

    - Vee

  • T-SQL will implicitly convert the value from a string to a float.  DTS isn't so forgiving.

    In the transformation, delete the connection from the source column to the destination, then re-create it.  In the dialog, specify "ActiveX".

    in Function Main() add:

        DTSDestination("F1") = CDbl(DTSSource("F1")

     

    That should do it.

  • Thanks, I will give it a try.

Viewing 3 posts - 1 through 2 (of 2 total)

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