<p>I've been banging my head against <code>SQL Server 2005</code> 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.</p>

<p>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?</p>

<p>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!</p>

[{'answer_id': 135, 'author': 'pix0r', 'author_id': 72, 'author_profile': 'https://Stackoverflow.com/users/72', 'pm_score': 3, 'selected': False, 'text': "<p>Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question).</p>\n\n<p>If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would recommend using PHP 5.2+ and the PDO libraries.  You'll be able to connect using PDO ODBC (and use MSSQL drivers).  I had a lot of problems getting large text fields and multi-byte characters from MSSQL into PHP using other libraries.</p>\n"}, {'answer_id': 141, 'author': 'Dillie-O', 'author_id': 71, 'author_profile': 'https://Stackoverflow.com/users/71', 'pm_score': 3, 'selected': False, 'text': '<p>Another tool to try would be the <a href="http://www.sqlmaestro.com" rel="nofollow noreferrer">SQLMaestro suite</a>. It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I\'d suggest trying the Data Wizard tool first for MySQL, since I believe that will have the proper &quot;import&quot; tool you need.</p>\n'}, {'answer_id': 160, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 6, 'selected': False, 'text': '<p>The best way that I have found is the <a href="http://www.mysql.com/products/tools/migration-toolkit/" rel="noreferrer">MySQL Migration Toolkit</a> provided by MySQL.  I have used it successfully for some large migration projects.</p>\n'}, {'answer_id': 64304, 'author': 'Sean', 'author_id': 8334, 'author_profile': 'https://Stackoverflow.com/users/8334', 'pm_score': 3, 'selected': False, 'text': '<p>SQL Server 2005 &quot;Standard&quot;, &quot;Developer&quot; and &quot;Enterprise&quot; editions have <a href="http://en.wikipedia.org/wiki/SQL_Server_Integration_Services" rel="nofollow noreferrer">SSIS</a>, which replaced DTS from SQL server 2000. SSIS has a built-in connection to its own DB, and you can find a connection that someone else has written for MySQL. <a href="http://jmayo.spaces.live.com/blog/cns!5F243997972597CE!399.entry" rel="nofollow noreferrer">Here</a> is one example. Once you have your connections, you should be able to create an SSIS package that moves data between the two.</p>\n<p>I ddin\'t have to move data from SQLServer to MySQL, but I imagine that once the MySQL connection is installed, it works the same as moving data between two SQLServer DBs, which is pretty straight forward.</p>\n'}, {'answer_id': 64384, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>Using MSSQL Management Studio i\'ve transitioned tables with the MySQL OLE DB.  Right click on your database and go to "Tasks->Export Data" from there you can specify a MsSQL OLE DB source, the MySQL OLE DB source and create the column mappings between the two data sources.  </p>\n\n<p>You\'ll most likely want to setup the database and tables in advance on the MySQL destination (the export will want to create the tables automatically, but this often results in failure). You can quickly create the tables in MySQL using the "Tasks->Generate Scripts" by right clicking on the database.  Once your creation scripts are generated you\'ll need to step through and search/replace for keywords and types that exist in MSSQL to MYSQL. </p>\n\n<p>Of course you could also backup the database like normal and find a utility which will restore the MSSQL backup on MYSQL. I\'m not sure if one exists however.</p>\n'}]
['https://Stackoverflow.com/questions/129', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/48/']