简体   繁体   English

从Ubuntu计算机将SQLDump导入SQL Server

[英]Importing SQLDump to SQL Server from Ubuntu machine

I have a situation wherein our current DB, in MySQL needs to be migrated to SQL Server. 我遇到的情况是,我们当前的MySQL数据库需要迁移到SQL Server。 For testing purposes, I have a created an RDS instance (SQL Server) on AWS and the connection to it via command line using isql works well. 出于测试目的,我在AWS上创建了一个RDS实例(SQL Server),并使用isql通过命令行与其进行了良好的连接。 However I have also exported the entire MySQL DB via phpmyadmin in MSSQL compatibility mode and trying to import the same to the SQL Server created above. 但是,我还通过phpmyadmin以MSSQL兼容模式导出了整个MySQL数据库,并尝试将其导入到上面创建的SQL Server中。 Whenever I run this command - 每当我运行此命令时-

isql -v MSSQL user 'password' db_name < path_to_sql

I get this error - 我收到此错误-

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

The following is a snippet from my sql file for one of the tables 以下是来自我的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'
);

Relatively new to SQL Server, any help will be appreciated! 相对于SQL Server而言,这是一个相对较新的功能,将不胜感激!

Try using single quotes rather than double quotes 尝试使用单引号而不是双引号

Edit - disregard 编辑-忽略

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM