正在将CSV文件导入SQL服务器... [英] Importing CSV file into SQL server...

查看:1719
本文介绍了正在将CSV文件导入SQL服务器...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨家伙,
我试图导入CSV文件到SQL服务器数据库,没有成功。我仍然是新手sql server,谢谢。

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


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)


推荐答案

在您的导入中:


错误0xc002f210:删除表SQL
任务1:执行查询drop
表[dbo]。[test]失败,出现
以下错误:无法删除
表'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和状态
text文本被截断或一个或
多个字符在$ b $中没有匹配b目标代码页。

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服务器...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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