Data Conversion Failed SQL

0

I am using the import and export wizard and imported a large csv file. I get the following error.

Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data 
conversion for column "firms" returned status value 2 and status text "The 
value could not be converted because of a potential loss of data.".
(SQL Server Import and Export Wizard)

Upon importing, I use the advanced tab and make all of the adjustments. As for the field in question, I set it is numeric (8,0). I have since went through this process multiple times and tried 7,8,9,10,and 11 to no avail. I import the csv into excel and look at the respective column, firms. It shows no entry with more than 5 characters. I thought about making it DT_String but will need to manipulate that column eventually by averaging it. Also, have searched for spaces or strange characters and found none.

Any other ideas?

import
ssis
type-conversion
asked on Stack Overflow Oct 11, 2017 by Tim Wilcox • edited Oct 12, 2017 by alroc

1 Answer

1

1) Try changing the Numeric precision to numeric(30,20) both in source and destination table.

2) Change the data type to str/wstr and adjust the output column width while importing. It will run fine. It happened with me as well while loading large CSV file of approx 5 GB. After load, use Try_convert function to convert it back to numeric and check the values which went null while conversion, you will find the root cause then.

answered on Stack Overflow Oct 12, 2017 by Ankit

User contributions licensed under CC BY-SA 3.0