Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 尝试插入时发生SQL错误_Mysql_Sql - Fatal编程技术网

Mysql 尝试插入时发生SQL错误

Mysql 尝试插入时发生SQL错误,mysql,sql,Mysql,Sql,为了快速将数据插入数据库,我一直在尝试创建一个巨大的SQL(大约200个查询),但是由于某种原因,我得到了SQL错误,但不确定是什么导致了它 错误: SQL错误(1064):您的SQL语法有错误;检查与MySQL服务器版本相对应的手册,以了解第8行附近的'6','1','21','4128','8388608','1','0','0','0','0','0',使用的正确语法 以下是我代码的一部分: SET @ID = 2710601; SET @DID = 420591; INSERT INT

为了快速将数据插入数据库,我一直在尝试创建一个巨大的SQL(大约200个查询),但是由于某种原因,我得到了SQL错误,但不确定是什么导致了它

错误:

SQL错误(1064):您的SQL语法有错误;检查与MySQL服务器版本相对应的手册,以了解第8行附近的
'6','1','21','4128','8388608','1','0','0','0','0','0',
使用的正确语法

以下是我代码的一部分:

SET @ID = 2710601;
SET @DID = 420591;

INSERT INTO item_template (entry, class, subclass, name, displayid, Quality, BuyCount, InventoryType, Flags, FlagsExtra, maxcount, ContainerSlots, BuyPrice, SellPrice, dmg_type1, dmg_type2, dmg_min1, dmg_min2, dmg_max1, dmg_max2, delay, ammo_type, RangedModRange, itemset, bonding, block, MaxDurability, sheath, holy_res, frost_res, fire_res, shadow_res, nature_res, arcane_res, socketColor_1, socketColor_2, socketColor_3, socketContent_1, socketContent_2, socketContent_3, socketBonus, GemProperties, spellid_1, spellid_2, spellid_3, spellid_4, spellid_5, spelltrigger_1, spelltrigger_2, spelltrigger_3, spelltrigger_4, spelltrigger_5, spellcharges_1, spellcharges_2, spellcharges_3, spellcharges_4, spellcharges_5, spellppmRate_1, spellppmRate_2, spellppmRate_3, spellppmRate_4, spellppmRate_5, spellcooldown_1, spellcooldown_2, spellcooldown_3, spellcooldown_4, spellcooldown_5, spellcategory_1, spellcategory_2, spellcategory_3, spellcategory_4, spellcategory_5, spellcategorycooldown_1, spellcategorycooldown_2, spellcategorycooldown_3, spellcategorycooldown_4, spellcategorycooldown_5, startquest, material, randomproperty, randomsuffix, area, map, disenchantid, pagetext, languageid, pagematerial, foodtype, lockid, holidayid, BagFamily, ArmorDamageModifier, duration, ItemLimitCategory, minMoneyLoot, maxMoneyLoot, flagscustom, TotemCategory, AllowableRace, AllowableClass, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, RequiredDisenchantSkill, StatsCount, stat_type1, stat_type2, stat_type3, stat_type4, stat_type5, stat_type6, stat_type7, stat_type8, stat_type9, stat_type10, stat_value1, stat_value2, stat_value3, stat_value4, stat_value5, stat_value6, stat_value7, stat_value8, stat_value9, stat_value10, ScalingStatDistribution, ScalingStatValue) VALUES
(@ID+13, '2', '10', 'Artifact Weapon', @DID+13, '6', '1', '21', '4128', '8388608', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1000', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '-1', '-1', '-1', '0', '0', '0', '0', '0', '-1', '-1', '-1', '-1', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')

不知道是什么原因导致了它,因为后面的“6”很好(可能与
@Defines
有关?我尝试了
:=(VALUE)
,但得到了相同的结果


非常感谢您的帮助。

您是否已尝试将其简化为只有一行出错的版本

SET @ID = 2710601;
SET @DID = 420591;

INSERT INTO item_template (entry, class, subclass, name, displayid, Quality, BuyCount, InventoryType, Flags, FlagsExtra, maxcount, ContainerSlots, BuyPrice, SellPrice, dmg_type1, dmg_type2, dmg_min1, dmg_min2, dmg_max1, dmg_max2, delay, ammo_type, RangedModRange, itemset, bonding, block, MaxDurability, sheath, holy_res, frost_res, fire_res, shadow_res, nature_res, arcane_res, socketColor_1, socketColor_2, socketColor_3, socketContent_1, socketContent_2, socketContent_3, socketBonus, GemProperties, spellid_1, spellid_2, spellid_3, spellid_4, spellid_5, spelltrigger_1, spelltrigger_2, spelltrigger_3, spelltrigger_4, spelltrigger_5, spellcharges_1, spellcharges_2, spellcharges_3, spellcharges_4, spellcharges_5, spellppmRate_1, spellppmRate_2, spellppmRate_3, spellppmRate_4, spellppmRate_5, spellcooldown_1, spellcooldown_2, spellcooldown_3, spellcooldown_4, spellcooldown_5, spellcategory_1, spellcategory_2, spellcategory_3, spellcategory_4, spellcategory_5, spellcategorycooldown_1, spellcategorycooldown_2, spellcategorycooldown_3, spellcategorycooldown_4, spellcategorycooldown_5, startquest, material, randomproperty, randomsuffix, area, map, disenchantid, pagetext, languageid, pagematerial, foodtype, lockid, holidayid, BagFamily, ArmorDamageModifier, duration, ItemLimitCategory, minMoneyLoot, maxMoneyLoot, flagscustom, TotemCategory, AllowableRace, AllowableClass, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, RequiredDisenchantSkill, StatsCount, stat_type1, stat_type2, stat_type3, stat_type4, stat_type5, stat_type6, stat_type7, stat_type8, stat_type9, stat_type10, stat_value1, stat_value2, stat_value3, stat_value4, stat_value5, stat_value6, stat_value7, stat_value8, stat_value9, stat_value10, ScalingStatDistribution, ScalingStatValue) VALUES
(@ID+7, '2', '10', 'Artifact Weapon', @DID+7  '6', '1', '21', '4128', '8388608', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1000', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '-1', '-1', '-1', '0', '0', '0', '0', '0', '-1', '-1', '-1', '-1', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
编辑:您在@DID+7和'6'之间缺少昏迷:

@DID+7  '6'

EDIT2:您如何自己解决此问题?用于隔离有问题的数据。

请将代码显示为格式化文本,而不是图像,也不是链接,当然也不是不可单击的link@HoneyBadger你是什么意思?什么部分?什么<代码> @ 3 +<代码>返回?他将这一行与其他行进行比较,看看是什么导致了问题。@MarekVitek因为@DID+0是420591,那么@DID+3应该等于420594。这看起来像是非常糟糕的设计。请参阅规范化。我不知道SQL查询中会出现错误的部分是什么,从我可以看出它应该工作并且正确地增加了ID&DID,我不知道。我只是从您的示例中复制了最少的代码,仅在第8行有数据。您应该自己尝试一下。如果此代码有效,那么您应该尝试从原始查询中删除数据,直到它起作用,然后您就会知道真正的错误在哪里。有时错误消息可能会产生误导。您没有提供表结构,因此没有人知道可以复制错误。如果没有,调试非常困难。-这是表结构(创建代码),请考虑将问题标记为已解决,所以其他试图帮助的人知道,不需要重新访问这个问题。谢谢帮助: