导入向导错误

时间:2014-07-02 17:45:30

标签: sql-server csv ssis bulkinsert

我希望有人可以帮助解决一个神秘的错误。

我在SQL Server中运行了一个查询,将结果保存为.csv,然后转过身来尝试将.csv导回到SQL Server中的另一个数据库并从中创建一个表使用导入向导。

但是当我这样做时,我收到以下错误消息:

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)

我尝试在Advanced对话框中转到Data Source并将ACCOUNT_NM更改为OutputColumnWidth 7090255,没有运气。

同样转到Advanced对话框中的Data Source,并将ACCOUNT_NM数据类型更改为DT_TEXTDT_NTEXT,但没有运气。

我已尝试转到Edit Mappings对话框并将Destination Type的{​​{1}}更改为ACCOUNT_NMNVARCHARVARCHARNVARCHAR(MAX)VARCHAR(MAX)仍然没有运气。

我还尝试了一个简单的TEXT语句BULK INSERT,其中包含以下错误:

FIELDTERMINATOR=';', ROWTERMINATOR='/n'

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:1)

我通过扩大带有错误的列的长度(在我的情况下包含描述的列)来解决错误0xc02020a1,从varchar(50)到varchar(100)。

问候