I'm hoping someone can help with a mystifying error.
I have run a query in SQL Server, saved the results as a .csv
, and then turned around and tried to import the .csv
back into another database in SQL Server and create a table from it using the import wizard.
But when I do that, I get the error messages below:
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "ACCOUNT_NM" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)
Error 0xc020902a: Data Flow Task 1: The "output column "ACCOUNT_NM" (22)" failed because truncation occurred, and the truncation row disposition on "output column "ACCOUNT_NM" (22)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)
Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "D:\Documents\James Project\Main Table\outer_query_new.csv" on data row 69.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - outer_query_new_csv" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
I've tried going to Advanced
in the Data Source
dialog box and changing the ACCOUNT_NM
to OutputColumnWidth 70
or 90
or 255
, with no luck.
Also going to Advanced
in the Data Source
dialog box and changing the ACCOUNT_NM
data type to DT_TEXT
or DT_NTEXT
, with no luck.
I've tried going to the Edit Mappings
dialog box and changing the the Destination Type
for ACCOUNT_NM
to NVARCHAR
, VARCHAR
, NVARCHAR(MAX)
, VARCHAR(MAX)
, and TEXT
with still no luck.
I've also tried a simple BULK INSERT
statement with FIELDTERMINATOR=';', ROWTERMINATOR='/n'
, which gives the errors below:
Msg 4866, Level 16, State 1, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
Greatly appreciate any help!
I solved Error 0xc02020a1 by enlarging the lenght of the columns with the error (the ones that hold descriptions in my case), From varchar(50) to varchar(100).
Greetings
User contributions licensed under CC BY-SA 3.0