从csv文件到SQL的批量加载数据转换错误

时间:2022-01-11 16:56:59

I have this problem inserting my data from csv file to my SQL database. I just don't get it why there is a error when i already replace some unwanted characters. it should be able to insert but i got this error.

我有这个问题从csv文件插入我的数据到我的SQL数据库。我只是不知道为什么当我已经替换了一些不需要的字符时出现错误。它应该能够插入但我得到了这个错误。

"Msg 4864, Level 16, State 1, Line 1 Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 13 (creditLimit)."

“消息4864,级别16,状态1,行1批量加载数据转换错误(类型不匹配或指定代码页的无效字符)第1行第13列(creditLimit)。”

this is my create table:

这是我的创建表:

CREATE TABLE Customers(
    customerNumber integer NOT NULL,
    customerName varchar(50) NOT NULL,
    customerLastName varchar(50) NOT NULL,
    customerFirstName varchar(50) NOT NULL,
    Phone varchar(50) NOT NULL,
    addressLine1 varchar(50) NOT NULL,
    addressLine2 varchar(50) NULL,
    city varchar(50) NOT NULL,
    [state] varchar(50) NULL,
    postalCode varchar(15) NOT NULL,
    country varchar(50) NOT NULL,
    salesRepEmployeeNumber integer NOT NULL,
    creditLimit double precision NOT NULL
    PRIMARY KEY(customerNumber) );

this is the first few lines of my csv file:

这是我的csv文件的前几行:

first line- 103,Atelier graphique,Schmitt,Carine ,40.32.2555,54 rue Royale,NULL,Nantes,NULL,44000,France,1370,21000

第一行 - 103,Atelier graphique,Schmitt,Carine,40.32.2555,54 rue Royale,NULL,Nantes,NULL,44000,France,1370,21000

second line- 112,Signal Gift Stores,King,Sue,7025551838,8489 Strong St.,NULL,Las Vegas,NV,83030,USA,1166,71800

第二行 - 112,Signal Gift Stores,King,Sue,7025551838,8489 Strong St.,NULL,Las Vegas,NV,83030,USA,1166,71800

im not sure why is there error can you please help me?

我不确定为什么会有错误你可以帮帮我吗?

1 个解决方案

#1


1  

I think it's because your rowterminator is wrong ... you should use \n not /n ...

我认为这是因为你的rowterminator错了......你应该使用\ n not / n ...

#1


1  

I think it's because your rowterminator is wrong ... you should use \n not /n ...

我认为这是因为你的rowterminator错了......你应该使用\ n not / n ...