我有一种情况,我们当前在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,任何帮助都将不胜感激!
答案 0 :(得分:0)
尝试使用单引号而不是双引号
编辑 - 忽略