我遇到的情况是,我们当前的MySQL数据库需要迁移到SQL Server。为了进行测试,我在AWS上创建了一个RDS实例(SQL Server),并使用isql通过命令行与其进行了很好的连接。
但是,我也已通过phpmyadmin以MSSQL兼容模式导出了整个MySQL数据库,并尝试将其导入到上面创建的SQL Server中。
每当我运行此命令时-
isql -v MSSQL user 'password' db_name < path_to_sql
我收到此错误-
SQL> CREATE TABLE "access_levels" (
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'access_levels'.
[ISQL]ERROR: Could not SQLExecute
SQL> "id" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'id'.
[ISQL]ERROR: Could not SQLExecute
SQL> "user_id" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'user_id'.
[ISQL]ERROR: Could not SQLExecute
SQL> "brand_id" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'brand_id'.
[ISQL]ERROR: Could not SQLExecute
SQL> "outlet_id" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'outlet_id'.
[ISQL]ERROR: Could not SQLExecute
SQL> "feature_id" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'feature_id'.
[ISQL]ERROR: Could not SQLExecute
SQL> "access" int NOT NULL,
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'access'.
[ISQL]ERROR: Could not SQLExecute
SQL> "created_at" timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'created_at'.
[ISQL]ERROR: Could not SQLExecute
SQL> "updated_at" timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'updated_at'.
[ISQL]ERROR: Could not SQLExecute
SQL> );
[37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near ')'.
[ISQL]ERROR: Could not SQLExecute
以下是我的sql文件中的一张表的摘录
CREATE TABLE "access_levels" (
"id" int NOT NULL,
"user_id" int NOT NULL,
"brand_id" int NOT NULL,
"outlet_id" int NOT NULL,
"feature_id" int NOT NULL,
"access" int NOT NULL,
"created_at" timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
"updated_at" timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
);
相对于SQL Server而言,这是一个相对较新的帮助,我们将不胜感激!
最佳答案
尝试使用单引号而不是双引号
编辑-忽略
关于mysql - 从Ubuntu计算机将SQLDump导入SQL Server,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38067069/