如何将数据从 SQL Server 2005 导出到 MySQL

2021-11-20 00:00:00 csv sql-server-2005 mysql sql-server bcp

我一直在反对 SQL Server 2005 试图获取大量数据.我得到了一个包含近 300 个表的数据库,我需要将其转换为 MySQL 数据库.我的第一个调用是使用 bcp 但不幸的是它不会产生有效的 CSV - 字符串没有被封装,所以你不能处理任何包含逗号的字符串的行(或任何你用作分隔符的行)而且我仍然需要手写所有的创建表语句,因为显然 CSV 不会告诉您有关数据类型的任何信息.

I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with any row that has a string with a comma in it (or whatever you use as a delimiter) and I would still have to hand write all of the create table statements, as obviously CSV doesn't tell you anything about the data types.

如果有一些工具可以连接到 SQL Server 和 MySQL,那就更好了,然后复制一份.您丢失了视图、存储过程、触发器等,但将仅使用基本类型的表从一个数据库复制到另一个数据库并不难......是吗?

What would be better is if there was some tool that could connect to both SQL Server and MySQL, then do a copy. You lose views, stored procedures, trigger, etc, but it isn't hard to copy a table that only uses base types from one DB to another... is it?

有人知道这样的工具吗?我不介意它做了多少假设或发生了什么简化,只要它支持整数、浮点数、日期时间和字符串.无论如何,我必须进行大量修剪、规范化等工作,因此我不在乎保留密钥、关系或类似内容,但我需要快速获取初始数据集!

Does anybody know of such a tool? I don't mind how many assumptions it makes or what simplifications occur, as long as it supports integer, float, datetime and string. I have to do a lot of pruning, normalising, etc. anyway so I don't care about keeping keys, relationships or anything like that, but I need the initial set of data in fast!

推荐答案

我发现的最好方法是 MySQL 迁移工具包 由 MySQL 提供.我已经成功地将它用于一些大型迁移项目.

The best way that I have found is the MySQL Migration Toolkit provided by MySQL. I have used it successfully for some large migration projects.

相关文章