MySql错误1261:第1行不包含所有列的数据 [英] MySql Error 1261: Row 1 doesn't contain data for all columns

查看:2975
本文介绍了MySql错误1261:第1行不包含所有列的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向数据库加载数据infile。我唯一的问题是我得到一个错误1261.我得到一个不正确的datetime值错误早,但我解决与加载数据infile下面的代码(设置date_time =)。我现在的问题是它说我没有足够的数据所有列。我知道你应该命名列的表名后,但我似乎不能得到它的工作。

I am trying to do a load data infile to a database. The only issue I have is I am getting a Error 1261. I was getting an incorrect datetime value error earlier but i solved that with the code in the load data infile below (set date_time = ). My problem now is it says that I don't have enough data for all columns. I know that you are supposed to name the columns after the name of the table but I can't seem to get it to work.

有一个表,它有15列。第一列是主键,其他十四是常规列。

There is one table and it has 15 columns. The first column is the primary key, the other fourteen are regular columns.

这里是加载文件语句:

load data infile 'c:/proj/test.csv' into table base (@var1,event,failure,ue,mc,mn,cell,durat,cause,ne,ims,hier,hier3,hier32)  
 set date_time = STR_TO_DATE(@var1, '%Y%m%d %H%i%s') 
;

附加注释:pk列被称为dataId,是一个INT
它是自动增量。

Additional notes: pk column is called dataId and is an INT It is auto increment.

以下是csv文件中的数据:

Here is the data from the csv file:

2013-03-20 14:55:22,4098,1,21060800,344,930,4,1000,0,11B,344930000000011,4809532081614990000,8226896360947470000,1150444940909480000 


推荐答案

尝试此

load data infile 'c:/proj/test.csv' into table base (@var1,event,failure,ue,mc,mn,cell,durat,cause,ne,ims,hier,hier3,hier32)  
 set date_time = STR_TO_DATE(@var1, '%Y%m%d %H%i%s') 
character set latin1
fields terminated by '\t' enclosed by '' escaped by '\\'
lines terminated by '\n' starting by ''
ignore 1 lines;

查看此处

这篇关于MySql错误1261:第1行不包含所有列的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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