2

I am looking to migrate data from MySQL to SQL Server. MY first idea is to take data backup in .bak format and dump into the SQL Server. So is there any way to get a MySQL database backup file in .bak format?

Else, is there any simpler, easier way to migrate data from MySQL to SQL Server?

2
  • you can always specify the dump file extension as .bak Commented May 5, 2012 at 4:58
  • 1
    .bak is a proprietary binary format specific to SQL server. MySQL can only dump to text-based files, which have the raw SQL statements to rebuild the db/tables/data. You can load that dump file into sql server's consoles and just run it as a long series of commands. Commented May 5, 2012 at 5:00

2 Answers 2

1

Did you try SSIS from MS SQL (shipped with Standard or higher version)? I don't know what you want to transfer, but tables and views are easy this way:

  1. Create a new MS SQL database (empty)
  2. Right click on the database and select task -> import data
  3. As source you select mySQL driver (Need to install before - http://dev.mysql.com/downloads/connector/odbc/)
  4. Choose the DB, connect to it, then follow the assistant to select views and tables
  5. At the end of the assistant you can save the SSIS package and edit it with a SSIS project in Visual Studio Business Intelligence (shipped also with MS SQL standard or higher) OR you just run it. If you run into transfer/convert problem you might need to edit it with the Studio version and modify the package to handle the tables/columns with problems.
Sign up to request clarification or add additional context in comments.

Comments

0

I hope you don't have to do this, but as a last-resort you can generate a custom SQL data dump as follows;

SELECT CONCAT_WS( ' '
   , 'INSERT INTO [dbo].[table_name] (col1,col2) VALUES'
   , col1
   , CONCAT( '"', col2, '"' )
   , ';'
) AS '-- Inserts'
FROM table_name
ORDER BY col1 ASC;

This can be as complex as you like, though I'd only recommend it if you experience problems getting your data into SQL Server due to e.g. automatic data conversion issues. Unless your data is massive, you'd probably be better off using mysqldump and filtering the output through e.g. sed or perl.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.