我在 sqlite 中收到双引号错误

I am getting double quotes error in sqlite

我正在 excel 中准备我的 SQL 查询,然后 c/p 到 sqlite 编辑器。我尝试了两个不同的编辑器,问题是一样的。例如,在 Excel 中,我的查询是这样的

INSERT INTO jokes_table (id, title, joke, cat, fav, bookmark)
VALUES ("9", "There''s this dyslexic guy... he walked into a bra...", "There''s this dyslexic guy... he walked into a bra...", "Bar", "0", "0");

在 sqlite 编辑器中变成

"INSERT INTO jokes_table (id, title, joke, cat, fav, bookmark) VALUES (""1"", ""What do you call a cow with no legs?

Ground Beef!"", ""What do you call a cow with no legs?

Ground Beef!"", ""Animal"", ""0"", ""0"");"

查询的开头和结尾有额外的引号。我知道这是因为“底线”而发生的,但如果我手动删除额外的引号,编辑器可以 运行 编码而不会出现任何错误,即使它有底线。有 10.000 个查询,我无法手动删除。我该如何解决?非常感谢

这可能不是最好的方法,但您可以将其另存为 Formatted Text (Space delimited) 并在以后使用它来复制粘贴。

2019 年 Excel

  1. 另存为 > 更多选项 >
  2. Save As Type 下拉列表中选择 Formatted Text (Space delimited)
  3. 将您的文件重命名为文件名。txt(.txt 而不是.prn)

打开并从那里复制粘贴

格式见下方截图


另一种解决方法是使用 Notepad++

  1. 在记事本++中打开csv
  2. 在查询的开头按 Alt 键并 select 全部 " 并删除。
  3. Select ;" -> 按 CTRL+H -> 将 ;" 替换为 ;
  4. 完成

见下方 GIF