converting nvarchar to Numeric

  • Hi there,

    I am using SSIS for converting CSV file into SQL table.

    here one of the column contains numbers and by default, I am getting it as a nvarchar datatype. But I want to turn it to Numeric datatype.

    I tried using Derived column for converting it... but while doing so, I am getting error:

    data conversion error 348 -- There could be potential data loss and hence can't be processed.

    I also tried using Convert function... but my problem is I have some blank field in the column and hence, I get error again.

    So, I am wondering how can I convert this particular column to numeric datatype.

    I tried expanding numeric (18,0) to max i.e. (38,0) but still,it fails.

    Please help me

    Thanks

  • The issue could be with the empty values. You may want to check for empty string in the Derived Column conversion and set that to Null.

  • I think you are correct. Its empty values causing the problem. Using conditional split, I was able to get only those rows where data contains numbers i.e. numeric values. I used ISNUMERIC().

    Now,I am thinking what should I do with these empty value cells. I am thinking to convert those blanks to NULL and then, can merge these rows to original table.

    As of now, I don't know how to do that... but i think CONVERT etc should work.

    Thanks

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

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