SQL Server 导入向导失败并显示无法理解的消息 [英] SQL Server Import wizard fails with incomprehensible message

查看:30
本文介绍了SQL Server 导入向导失败并显示无法理解的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想将平面文件中的两列导入到新表中.我已将一列代码"设置为 varchar(50),将另一列说明"设置为 nvarchar(max).

I just want to import two columns from a flat file into a new table. I have set one column, 'Code', to be varchar(50), and another column, 'Description', to be nvarchar(max).

导入失败并显示以下消息:

The import fails with the following messages:

- Executing (Error)
Messages
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "Description" 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 "Description" (14)" failed because truncation occurred, and the truncation row disposition on "output column "Description" (14)" 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 "C:\Users\rinaldo.tempo\Desktop\ICD10_Edition4_CodesAndTitlesAndMetadata_GB_20120401.txt" on data row 3.
 (SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Source - ICD10_Edition4_CodesAndTitlesAndMetadata_GB_20120401_txt" (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)

错误消息向我表明数据被截断,因为它被放置在 nvarchar(max) 类型的描述"列中!仔细观察输入数据后,我会说描述永远不会超过 2 或 300 个字符,所以这是不可能的.

The error message suggests to me that data is getting truncated as it's being placed in the 'Description' column, which is of type nvarchar(max)! Having eyeballed the input data, I would say the descriptions are never more than around 2 or 300 characters, so this is out of the question.

有人可以建议这里有什么问题吗?

Can anyone suggest what is wrong here?

推荐答案

在导入中,字符串列的默认大小为 50 个字符.这种截断发生在数据进入您的数据库之前.您应该在导入向导的第一步中进行调整,在 Columns 部分.

The default size for string columns, in the import, is 50 characters. This truncation happens before data goes to your database. You should adjust this in the first step of the Import Wizard, in the Columns section.

这篇关于SQL Server 导入向导失败并显示无法理解的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆