当前位置: 首页 > 知识库问答 >
问题:

尝试插入时发生SQL错误

严俊友
2023-03-14

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

错误:

SQL错误(1064):您的SQL语法有错误;查看与您的MySQL server版本相对应的手册,以了解在第8行“6”,“1”,“21”,“4128”,“8388608”,“1”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“0”,“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')

你可以在Pastebin上找到我的完整SQL。

不知道是什么原因造成的,因为后面的“6”是完全正常的(可能与@definities有关?我确实尝试使用:=(VALUE),但结果是一样的。

感谢任何帮助。

共有1个答案

狄峰
2023-03-14

并且您是否尝试将其缩小到只有行才会出现错误的版本。

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'

编辑2:你自己怎么解决这个问题?使用二分法隔离有问题的数据。

 类似资料:
  • 问题内容: 遵循Android标签的任何人都可能对我很熟悉。我很难为我的高分实现SQLite数据库。这也是我第一次使用SQLite。 我正在尝试仅插入两个变量-int和long。我的方法无法正常工作。除了上面讨论的内容外,任何其他建议也应受到赞赏。 预先感谢您的帮助。 Highscores.java DatabaseHelper.java LogCat输出 问题答案: 在这行上,打开数据库: 这会

  • 尝试使用此查询 #1064-您的SQL语法有错误; 表和几乎完全相同-有相同的列。 请求中有什么错误?

  • 问题内容: 在Windows上安装了Docker,并额外安装了2个Oracle VM VirualBox和Kitematic。我在Windows 10 PC中禁用了Hyper-V。现在的问题是我无法从DockerHub下载任何Docker映像,甚至我都无法以如下方式运行命令 两端都显示以下错误。 尝试连接时发生错误:获取 http:// localhost:2375 / v1.21 / info

  • 我正在尝试在表a中插入外键(在phpmyadmin中): 将表A添加外键(id_B)引用B(id_B); 但我得到了一个错误: 表A的id_A为主键,表B的id_B为主键。这两个表都使用innoDB作为存储引擎,表A中的id_B列和表B中的id_B列具有相同的类型。 出了什么问题,我该如何解决?

  • 大约34小时前,我生成了一个签名的apk,但现在,我无法生成一个签名的apk,我不知道如何解决这个问题。请帮忙 这是我的输出消息 > 错误:任务“:app:LintVitalRelease”执行失败。 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获得完整的见解。 这是我的Build.Gradle(应用程

  • 我试图从部署在Jetty中的war中实现一个JSR356 websocket连接。 我将此作为指南:http://aredko.blogspot.com/2013/11/java-websockets-jsr-356-on-jetty91.html (我可以找到很多关于在嵌入式jetty服务器上基本使用JSR356的教程,但是没有关于在现有服务器中构建websocket连接的教程--有什么好的教程