Errors in SQL Server while importing CSV file despite varchar(MAX) being used for each column -
i'm trying insert large csv file (several gigs) sql server, once go through import wizard , try import file following error report:
executing (error) messages error 0xc02020a1: data flow task 1: data conversion failed. data conversion column ""title"" returned status value 4 , status text "text truncated or 1 or more characters had no match in target code page.". (sql server import , export wizard)
error 0xc020902a: data flow task 1: "source - train_csv.outputs[flat file source output].columns["title"]" failed because truncation occurred, , truncation row disposition on "source - train_csv.outputs[flat file source output].columns["title"]" specifies failure on truncation. truncation error occurred on specified object of specified component. (sql server import , export wizard)
error 0xc0202092: data flow task 1: error occurred while processing file "c:\train.csv" on data row 2. (sql server import , export wizard)
error 0xc0047038: data flow task 1: ssis error code dts_e_primeoutputfailed. primeoutput method on source - train_csv returned error code 0xc0202092. component returned failure code when pipeline engine called primeoutput(). meaning of failure code defined component, error fatal , pipeline stopped executing. there may error messages posted before more information failure. (sql server import , export wizard)
i created table insert file first, , set each column hold varchar(max), don't understand how can still have truncation issue. doing wrong?
in sql server import , export wizard can adjust source data types in advanced
tab (these become data types of output if creating new table, otherwise used handling source data).
the data types annoyingly different in ms sql, instead of varchar(255)
it's dt_str
, output column width can set 255
. varchar(max)
it's dt_text
.
so, on data source selection, in advanced
tab, change data type of offending columns dt_str
dt_text
(you can select multiple columns , change them @ once).
Comments
Post a Comment