Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a database schema from MySQL which I want to import to SQL SERVER, I have tried dumping from MySQL with compatibility for SQL Server, but with no success. Tried dumping as Excel still no dice. Does anyone know another way to import this database with no records from MySQL to SQL SERVER 2012? Thanks for your time.

share|improve this question
    
What problems did you encounter with the dump (sqlserver compatibility)? How does the dump file look like once opened with an editor? –  KookieMonster Apr 8 '13 at 10:48
    
Within sql server when I try to run the file as a query, troggers and all, I get several syntax errors. From the CREATE TABLE DROP IF EXISTS commands to the int data type declarations. After dumping the file to .sql I could just open it with sql server and that is how I tried to run the query. –  kabuto178 Apr 8 '13 at 11:47
add comment

1 Answer 1

I recently had to do essentially the same thing, except that I wanted to migrate MySQL tables and data to SQL Server. I tried:

  • using phpMyAdmin to Export the table definitions with "MSSQL" compatibility: The resulting SQL script would not execute in SQL Server Management Studio (SSMS) due to syntax errors.

  • using HeidiSQL to export the MySQL database directly to SQL Server: HeidiSQL also generated SQL statements that SQL Server would not accept.

  • using MySQL Workbench: I could not find a way to migrate a database from MySQL to SQL Server.

  • using MySQL ODBC and the SQL Server Import and Export Wizard: The wizard crashed (i.e., the Windows "[Application name] has stopped working..." error) when trying to access the MySQL database.

The only method that didn't fail outright was to pull the tables from MySQL into a Microsoft Access .mdb file (!) via MySQL ODBC, then import that into SQL Server.

However, even that was an incomplete solution because the transfer from MySQL to Access omitted all of the primary keys, indexes, and AUTO_INCREMENT attributes. Still, it did transfer the tables and data, which was my main objective. I just had to write some T-SQL to re-create the indexes and whatnot.

Since you don't need to transfer any data you might want to consider just hacking the mysqldump SQL code (good old Find & Replace...) to the point where SQL Server will execute it.

share|improve this answer
    
Thanks for the advice, this has been giving me a bit of trouble as it seems we tried similar solutions. –  kabuto178 Apr 8 '13 at 12:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.