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.
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.
The easiest way could be:
- Export your MySql database as a csv file with the name of the columns as headers.
- Create an empty database in SQL (I did it on SQL Server 2012)
- Import the csv file into the empty database. You might need an ODBC component depending on which version of SQL and Framework you are working on (Microsoft.ACE.OLEDB.12.0). I noticed The Keys were missing, but I just added them manually.