大家好,我正在尝试将CSV文件导入SQL服务器数据库,但没有成功.我仍然是sql server的新手,谢谢.
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)
Eoa*_*oan 14
"文本被截断,或者目标代码页中的一个或多个字符不匹配."
甚至可能发生在:
和
我花了一段时间才弄明白.
原因
SSIS通过扫描前N行并进行有根据的猜测来推断源文件中的数据类型.由于无休止地重复尝试使其工作,它已将数据类型(OutputColumnWidth)的元数据停放在某处的某处50个字符,从而导致包内部截断.
解析度
摆弄数据源的"高级"选项卡中的元数据是您要解决问题的方法.尝试使用"建议类型"中的设置重置整个内容,或逐个字段地调整设置.在我的案例中需要一个真正令人沮丧的迭代次数(广泛的输入文件),但最终你可以让它工作.
导入中确实存在两个主要问题:
错误0xc002f210:删除表SQL任务1:执行查询"drop table [dbo].[test]"失败,出现以下错误:"无法删除表'dbo.test',因为它不存在或者您没有许可."
看起来你正试图放下一张甚至不存在的桌子.解决方案:就是不要这样做!
错误0xc02020a1:数据流任务1:数据转换失败.列""代码""的数据转换返回状态值4和状态文本"文本被截断,或者目标代码页中的一个或多个字符不匹配.".
您的"代码"列显然比目标表中的结果列长.检查映射 - 可能这是一个非常长的字符串,SQL Server中VARCHAR列的默认长度太小.将目标列的数据类型更改为例如VARCHAR(MAX)- 为您提供2 GB的空间!那应该够了......
此外,"代码"列似乎包含SQL Server中当前所选代码页中不存在的字符 - 您可以在导入之前删除这些额外的特殊字符吗?如果没有,您可能需要使用NVARCHAR(MAX)目标列的数据类型,以允许它为其字符使用Unicode(从而支持输入字符串中最奇特的字符).
| 归档时间: |
|
| 查看次数: |
44075 次 |
| 最近记录: |