我将Stack Overflow数据转储下载为XML文件。然后,我将XML文件转换为SQL文件。我试图使用包含所有发布数据的SQL文件,并将其导入到我的MySQL数据库中。但是,这样做时,我收到以下错误消息:


  第1行的RROR 1064(42000):您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以在第1行的')'附近使用正确的语法


我查看了我的posts.sql文件,但找不到语法错误。这是posts.sql文件的前30行:

insert into posts(Body, ViewCount, LastActivityDate, Title, LastEditorUserId,
                    LastEditorDisplayName, LastEditDate, CommentCount,
                    AnswerCount, AcceptedAnswerId, Score, CommunityOwnedDate,
                    PostTypeId, OwnerUserId, Tags, CreationDate, FavoriteCount, Id)
values
(
    "<p>I want to use a track-bar to change a form\'s opacity.</p>

    <p>This is my code:</p>

    <pre><code>decimal trans = trackBar1.Value / 5000;
    this.Opacity = trans;
    </code></pre>

    <p>When I try to build it, I get this error:</p>

    <blockquote>
      <p>Cannot implicitly convert type \'decimal\' to \'double\'.</p>
    </blockquote>

    <p>I tried making <strong>trans</strong> to <strong>double</strong>, but then the control doesn\'t work. This code has worked fine for me in VB.NET in the past. </p>",
    "15207",
    "2014-01-03T02:42:54.963",
    "When setting a form\'s opacity should I use a decimal or double?",
    "2648239",
    "Rich B",
    "2014-01-03T02:42:54.963",
    "25",
    "13",
    "7",
    "251",
    "2012-10-31T16:42:47.213",
    "1",
    "8",
    "<c#><winforms><forms><type-conversion><opacity>",
    "2008-07-31T21:42:52.667",
    "23",
    "4",
);

insert into posts(Body, ViewCount, LastActivityDate, Title, LastEditorUserId,
                    LastEditorDisplayName, LastEditDate, CommentCount, AnswerCount,
                    AcceptedAnswerId, Score, PostTypeId, OwnerUserId, Tags,
                    CreationDate, FavoriteCount, Id)

values
(
    "<p>I have an absolutely positioned <code>div</code> containing several children, one of which is a relatively positioned <code>div</code>. When I use a percentage-based width on the child <code>div</code>, it collapses to <code>0</code> width on IE7, but not on Firefox or Safari. </p>

    <p>If I use pixel width, it works. If the parent is relatively positioned, the percentage width on the child works. </p>

    <p>Is there something I\'m missing here?
    Is there an easy fix for this besides the pixel-based width on the child?
    Is there an area of the CSS specification that covers this?</p>",
    "8524",
    "2013-11-20T04:16:38.813",
    "Why doesn\'t the percentage width child in absolutely positioned parent work",
    "243557",
    "Rich B",
    "2013-10-04T01:14:10.373",
    "12",
    "5",
    "31",
    "121",
    "1",
    "9",
    "<html><css><css3><internet-explorer-7>",
    "2008-07-31T22:08:08.620",
    "7",
    "6",
);

insert into posts(Body, LastActivityDate, LastEditorUserId, PostTypeId, LastEditDate,
                    CommentCount, Score, ParentId, OwnerUserId, CreationDate, Id)

values (
    "<p>An explicit cast to double isn\'t necessary.</p>

    <pre><code>double trans = (double)trackBar1.Value / 5000.0;
    </code></pre>

    <p>Identifying the constant as <code>5000.0</code> (or as <code>5000d</code>) is sufficient:</p>

    <pre><code>double trans = trackBar1.Value / 5000.0;


怎么了

最佳答案

您插入的值列表不正确(需要删除最后一个逗号)

... values("val", "val",)


将其修复为:

... values("val", "val")

07-24 21:15