SQL错误13000 HY000

时间:2017-03-10 19:35:02

标签: sql database

use defpass; 

create table creds (
entry_date DATE,
vendor VARCHAR(23),
username VARCHAR(13),
password VARCHAR(19),
comments VARCHAR(48)
);

load data local infile '/Users/baileystiles/Desktop/default-passwords.csv'
Into Table creds
fields terminated by ','; 

SELECT STR_TO_DATE('11,3,13','%m,%d,%y');

尝试将csv文件加载到我的数据库中,我收到一个错误,说明了无效的uft8字符串'后门'。确实有需要很好地转换为字符串的日期。我使用STR_TO_DATE函数

2 个答案:

答案 0 :(得分:1)

尝试使用NVARCHAR:

use defpass; 

create table creds (
entry_date DATE,
vendor NVARCHAR(23),
username NVARCHAR(13),
password NVARCHAR(19),
comments NVARCHAR(48)
);

load data local infile '/Users/baileystiles/Desktop/default-passwords.csv'
Into Table creds
fields terminated by ','; 

答案 1 :(得分:0)

将列的数据类型更改为nvarchar(..),然后您就不会被code page

打扰