将CSV文件导入SQL Server时操作停止 [英] Operation stopped while importing CSV file into SQL server

查看:159
本文介绍了将CSV文件导入SQL Server时操作停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将CS​​V文件导入SQL Server数据库,但没有成功.我仍然是SQL Server的新手.

I am trying to import CSV file to SQL server database, with no success. I am still newbie to sql server.

操作已停止...

  • 初始化数据流任务(成功)

  • Initializing Data Flow Task (Success)

初始化连接(成功)

设置SQL命令(成功)

Setting SQL Command (Success)

设置源连接(成功)

设置目标连接(成功)

验证(成功)消息

  • 警告0x80049304:数据流任务1:警告:无法打开全局共享内存以与性能DLL进行通信;因此,无法打开全局共享内存.数据流性能计数器不可用.要解决此问题,请以管理员身份或在系统控制台上运行此程序包.(SQL Server导入和导出向导)

准备执行(成功)

预执行(成功)消息

  • 信息0x402090dc:数据流任务1:处理文件"D:\ test.csv".已经开始了.(SQL Server导入和导出向导)

执行中(错误)消息

  • 错误0xc002f210:删除表SQL任务1:执行查询删除表[dbo].[测试]"失败,并显示以下错误:无法删除表'dbo.test',因为它不存在或您没有权限.".可能的失败原因:查询"ResultSet"存在问题.属性设置不正确,参数设置不正确或连接建立不正确.(SQL Server导入和导出向导)

  • 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)

错误0xc02020a1:数据流任务1:数据转换失败.对列代码"进行数据转换.返回状态值4和状态文本文本被截断或目标代码页中的一个或多个字符不匹配.".(SQL Server导入和导出向导)

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)

错误0xc020902a:数据流任务1:(38)";失败是因为发生了截断,并且截断行配置在输出列"代码"(38)";指定截断失败.在指定组件的指定对象上发生了截断错误.(SQL Server导入和导出向导)

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)

错误0xc0202092:数据流任务1:在处理文件"D:\ test.csv"时发生错误.在数据行21上.(SQL Server导入和导出向导)

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)

错误0xc0047038:数据流任务1:SSIS错误代码DTS_E_PRIMEOUTPUTFAILED.组件源-test_csv"上的PrimeOutput方法被指定为源-test_csv".(1)返回错误代码0xC0202092.当管道引擎调用PrimeOutput()时,该组件返回失败代码.故障代码的含义由组件定义,但错误是致命的,并且管道停止执行.在此之前可能会发布错误消息,其中包含有关失败的更多信息.(SQL Server导入和导出向导)

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)

复制到[dbo].[测试](已停止)

Copying to [dbo].[test] (Stopped)

执行后(成功)消息

  • 信息0x402090dd:数据流任务1:处理文件"D:\ test.csv".结束了.(SQL Server导入和导出向导)

  • Information 0x402090dd: Data Flow Task 1: The processing of file "D:\test.csv" has ended. (SQL Server Import and Export Wizard)

信息0x402090df:数据流任务1:在组件"目的地-测试"中,用于数据插入的最终提交;(70)"已经开始了.(SQL Server导入和导出向导)

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)

信息0x402090e0:数据流任务1:在组件"目的地-测试"中最后插入数据.(70)"结束了.(SQL Server导入和导出向导)

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)

信息0x4004300b:数据流任务1:组件"目的地-测试";(70)"写了0行.(SQL Server导入和导出向导)

Information 0x4004300b: Data Flow Task 1: "component "Destination - test" (70)" wrote 0 rows. (SQL Server Import and Export Wizard)

推荐答案

您的导入确实存在两个主要问题:

You really have two major problems in your import:

错误0xc002f210:删除表SQL任务1:执行查询删除"表[dbo].[测试]失败,出现以下错误:无法删除表'dbo.test',因为它没有存在或您没有权限.".

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.".

似乎您正在尝试删除一个根本不存在的表.解决方案:只是不要这样做!

It seems like you're trying to drop a table that doesn't even exist. Solution: just don't do it!

错误0xc02020a1:数据流任务1:数据转换失败.数据列代码"的转换返回状态值4和状态文字文字被截断,或者一个或在中没有更多的字符匹配目标代码页.".

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中VARCHAR列的默认长度太小.将目标列的数据类型更改为例如 VARCHAR(MAX)-给您2 GB的空间!那应该足够了...

Your column "Code" obviously is longer than the resulting column that you have in your target table. Check the mappings - maybe this is a very long character string, and the default length for the VARCHAR column in SQL Server is too small. Change the target column's data type to e.g. VARCHAR(MAX) - that gives you 2 GByte of space! That should be enough....

此外,代码"列似乎包含了您在SQL Server当前选择的代码页中不存在的字符-您可以在导入之前去除那些多余的特殊字符吗?如果不是,您可能需要对目标列的数据类型使用 NVARCHAR(MAX),以便允许它对字符使用Unicode(从而甚至支持输入字符串中最奇特的字符)

Also it seems that "Code" column contains characters that aren't present in your currently selected code page in SQL Server - can you strip those extra special characters before importing? If not, you might need to use NVARCHAR(MAX) for your target column's data type in order to allow it to use Unicode for its characters (thus supporting even the most exotic of characters in your input string).

这篇关于将CSV文件导入SQL Server时操作停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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