Operation stopped... - Initializing Data Flow Task (Success) - Initializing Connections (Success) - Setting SQL Command (Success) - Setting Source Connection (Success) - Setting Destination Connection (Success) - Validating (Success) Messages * Warning 0x80049304: Data Flow Task 1: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available. To resolve, run this package as an administrator, or on the system's console. (SQL Server Import and Export Wizard) - Prepare for Execute (Success) - Pre-execute (Success) Messages * Information 0x402090dc: Data Flow Task 1: The processing of file "D:\test.csv" has started. (SQL Server Import and Export Wizard) - Executing (Error) Messages * Error 0xc002f210: Drop table(s) SQL Task 1: Executing the query "drop table [dbo].[test] " failed with the following error: "Cannot drop the table 'dbo.test', because it does not exist or you do not have permission.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. (SQL Server Import and Export Wizard) * Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column ""Code"" 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 ""Code"" (38)" failed because truncation occurred, and the truncation row disposition on "output column ""Code"" (38)" 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:\test.csv" on data row 21. (SQL Server Import and Export Wizard) * Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - test_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) - Copying to [dbo].[test] (Stopped) - Post-execute (Success) Messages * Information 0x402090dd: Data Flow Task 1: The processing of file "D:\test.csv" has ended. (SQL Server Import and Export Wizard) * Information 0x402090df: Data Flow Task 1: The final commit for the data insertion in "component "Destination - test" (70)" has started. (SQL Server Import and Export Wizard) * Information 0x402090e0: Data Flow Task 1: The final commit for the data insertion in "component "Destination - test" (70)" has ended. (SQL Server Import and Export Wizard) * Information 0x4004300b: Data Flow Task 1: "component "Destination - test" (70)" wrote 0 rows. (SQL Server Import and Export Wizard)
答案 0 :(得分:13)
“文字被截断或一个或多个 角色在目标中没有匹配 代码页。“
可能在以下情况下发生:
和
我花了一段时间才弄明白。
<强>原因强>
SSIS通过扫描前N行并进行有根据的猜测来推断源文件中的数据类型。由于无休止地重复尝试使其工作,它已将数据类型(OutputColumnWidth)的元数据停放在某处的某处50个字符,从而导致包内部截断。
解决强>
摆弄数据源的“高级”选项卡中的元数据是您要解决问题的方法。尝试使用“建议类型”中的设置重置整个内容,或逐个字段地调整设置。在我的案例中需要一个真正令人沮丧的迭代次数(广泛的输入文件),但最终你可以让它工作。
答案 1 :(得分:7)
导入时确实存在两个主要问题:
错误0xc002f210:删除表SQL 任务1:执行查询“drop table [dbo]。[test]“失败了 以下错误:“不能放弃 表'dbo.test',因为它没有 存在或您没有权限。“。
好像你正试图放弃一个甚至不存在的表。解决方案:就是不要这样做!
错误0xc02020a1:数据流任务1: 数据转换失败。数据 列“”代码“”的转换 返回状态值4和状态 文本“文本被截断或一个或 更多的角色没有匹配 目标代码页。“。
您的“代码”列显然比目标表中的结果列长。检查映射 - 可能这是一个非常长的字符串,SQL Server中VARCHAR列的默认长度太小。将目标列的数据类型更改为例如VARCHAR(MAX)
- 为您提供2 GB的空间!那应该够了....
此外,“代码”列似乎包含SQL Server中当前所选代码页中不存在的字符 - 您可以在导入之前删除这些额外的特殊字符吗?如果没有,您可能需要使用NVARCHAR(MAX)
作为目标列的数据类型,以允许它为其字符使用Unicode(从而支持输入字符串中最奇特的字符)。
答案 2 :(得分:1)
我遇到了同样的问题:
Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "target" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
解决方案是转到“高级”并将列宽更改为255.
答案 3 :(得分:1)
或者您也可以通过转到高级检查文本的大小,然后检查建议,然后将字符串转换为unicode字符串。它有助于解决字符串相关的错误。我最近一直在面对他们!
答案 4 :(得分:0)
鉴于此事情非常快,建议逐个字段地使用建议类型和调整设置。如果要直接创建最终表,则可能需要稍微增加列宽以便以后输入数据。我建议只计算导入文件中的行数,并将整个集扫描为“样本”。任何不足都可能导致错误。调整它的时间可能不值得你花时间。
答案 5 :(得分:0)
对于“Error 0xc02020a1”,我的案例是通过从CSV文件端更改单元格格式来解决的: (通过excel打开CSV文件&gt;&gt;将单元格格式从百分比更改为常规然后保存),这解决了我的情况。