【发布时间】:2013-10-24 16:22:47
【问题描述】:
我有一个 .mdb 文件正在尝试导出到 mySQL 数据库。
使用mdb-schema Data.mdb | mysql -u root -p Database
我收到以下错误:
ERROR 1064 (42000) at line 11: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[Attachments]
(
[ItemID] Long Integer,
[Description] Text (510),
[Pare' at line 1
mdb-schema 的代码输出(在管道实际上看起来像这样之前)
1 -- ----------------------------------------------------------
2 -- MDB Tools - A library for reading MS Access database files
3 -- Copyright (C) 2000-2011 Brian Bruns and others.
4 -- Files in libmdb are licensed under LGPL and the utilities under
5 -- the GPL, see COPYING.LIB and COPYING files respectively.
6 -- Check out http://mdbtools.sourceforge.net
7 -- ----------------------------------------------------------
8
9 -- That file uses encoding UTF-8
10
11 CREATE TABLE [Attachments]
12 (
13 [ItemID] Long Integer,
14 [Description] Text (510),
15 [ParentItemID] Long Integer,
16 [Path] Memo/Hyperlink (255),
17 [AttachmentType] Long Integer,
18 [Notes] Text (510),
19 [Imported] Boolean NOT NULL
20 );
21
+ 其他一些表格
这实际上意味着语法错误出现在 cmets 之后的第一行?你能帮我解决这个问题吗?在跛脚的眼里,它看起来很有效。
提前致谢:)
【问题讨论】:
-
MySQL 是否将方括号识别为表/列名称的分隔符?我似乎记得 MySQL 为此使用了反引号 (`)。我还想知道 MySQL 将如何对“备忘录/超链接”作为列类型做出反应。 (不过,我已经有一段时间没有用 MySQL 做了太多工作了。)
-
我相信你需要
varchar,而不是Text。 -
将 [(.+)] 更改为 '$1' 并没有改变任何内容。第一行仍然出错。