简体   繁体   English

将MSSQL DDL转换为MySQL DDL

[英]Converting MSSQL DDL to MySQL DDL

This question is the exact opposite of Converting MySQL DDL to SQL Server DDL . 这个问题 将MySQL DDL转换为SQL Server DDL 完全相反

I have a SQL Server 2008 DDL file. 我有一个SQL Server 2008 DDL文件。 I want to import it into MySQL. 我想将其导入MySQL。

Is there any tool or suggestion to achieve this? 有什么工具或建议可以实现这一目标吗?

One could use Navicat Premium in combination with a real instance of MSSQL and MySQL. 可以将Navicat Premium与MSSQL和MySQL的实际实例结合使用。

  1. Create connections to both DBs 创建到两个数据库的连接
  2. Import the DDL to the real SQL Server instance 将DDL导入到真实的SQL Server实例
  3. Right click the SQLServer DB, then use Data Transfer... wizard 右键单击SQLServer DB,然后使用“ Data Transfer...向导
  4. In left panel, select SQL Server connection, database and schema to transfer 在左侧面板中,选择要传输的SQL Server连接,数据库和架构
  5. In right panel, select MySQL connection and database 在右侧面板中,选择“ MySQL连接和数据库”
  6. Click Start 点击Start

I found that my DDL spans across multiple schemas. 我发现我的DDL跨越多个架构。 I had to merge all the tables in one schemas repeating the transfer for each source schema to the target database. 我必须将所有表合并到一个模式中,重复每个源模式到目标数据库的传输。 AFAIK this is due to the nature of SQL Server VS MySQL, where the former defines a tree structure Server->Database->Schema and the latter only Server->Database, where actually database is a synonim of schema. AFAIK这是由于SQL Server VS MySQL的特性所致,前者定义树结构Server-> Database-> Schema,而后者仅定义树结构Server-> Database,其中数据库实际上是架构的同义词。

Unfortunately, this looked like not transferring foreign keys declarations to the target database. 不幸的是,这看起来好像没有将外键声明传输到目标数据库。

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

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