“列数与行中的值数不匹配"但它确实 [英] "Column count doesn't match value count at row" but it does

查看:39
本文介绍了“列数与行中的值数不匹配"但它确实的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含超过 14000 条语句的 mysql 文件.所有这些都是插入到表中,当我使用控制台导入文件时,它会引发以下错误:

I've got a mysql file with over than 14000 statements. All of them are inserts into a table, and when I import the file using console, it throws the following error:

ERROR 1136 (21S01) at line 1548: Column count doesn't match value count at row 45

我知道当列名中指定的行与 VALUES 列表中指定的行不同时会出现错误,但我已经检查过很多次并且两个列表中的列数完全相同.

I know that error appears when the rows specified in column names are different from the rows specified in VALUES list, but I've checked it out many times and the number of columns is exactly the same in both lists.

位置 45 的行是:

('00553', 'AAA', 'BBB', 'CCC', 'XXXXXXXXR', 'user address', 'spain', 'spain', '39212', '1900-01-21', '123456789', 'M', 'No disponible', 0, 'AAA', 'BBB ', 'CCC', 'XXXXXXXXR', NULL, '888993344', '', '', '', '', 'no', 'no') --> 26 columns

以及与之关联的插入行,上面的很多行是:

and the insert line associated with it, many lines above is:

INSERT INTO `users` (`id_patient`, `name`, `surname1`, `surname2`, `dni`, `address`, `city`, `state`, `postal_code`, `birthday`, `telephone`, `sex`, `email`, `lopd_status`, `lopd_name`, `lopd_surname1`, `lopd_surname2`, `lopd_dni`, `lopd_as`, `mobile_phone`, `notes`, `job`, `company`, `place`, `active_citation`, `signature`)  --> 26 columns

我已经查找过此错误,但似乎仅在计数不同时才会出现,但在本例中,它是相同的.

I've looked for this error but it seems it only appears when count is different, but in this case, it is the same.

有什么想法吗?

忘了提:如果我直接在 phpmyadmin 上抛出 sql 语句,它会正确添加该行而没有任何错误.它只在从命令行运行时崩溃,尽管上面的语句正确插入到数据库中并且它们几乎与此相同.

forgot to mention: if I throw the sql statement directly on phpmyadmin, it adds the line correctly without any errors. It only crashes when run from command line, although the statements above it are correctly inserted into database and they are almost the same than this one.

我已经删除了 46 之前的所有行,当我启动文件时,错误如下:

I've removed all lines until the 46 and when I launch the file the erros is the following:

ERROR 1136 (21S01) at line 1503: Column count doesn't match value count at row 45

它只更改了行,但该行是 INSERT 语句,它与文件其余部分中的其他 INSERT 语句完全相同.上一行也是正确的.

It only changes the line, but that line is the INSERT statement, which is exactly the same as the other INSERT statements in the rest of the file. The previos line is also correct.

推荐答案

我遇到了类似的问题,因为在数据周围插入括号 :-(:

I faced a similar problem because of inserting parenthesis around data :-(:

INSERT INTO Customers (Name,LastCredit,CreditDate) VALUES ( <-- Here.
    ("Nuclear Millitary Systems",500.0,CURRENT_DATE),
    ("Evil Corporation",67890.95,"2012-02-12"),
    ("Nuke Software Systems",5600.0,"2013-05-06"),
    ("RR Millitary",600.0,"2013-05-06"),
    ("Random Automation",560.0,"2012-05-01"),
    ("Evil Data Systems",600.0,"2013-03-01")
  ); 

这篇关于“列数与行中的值数不匹配"但它确实的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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