0

I exported a MySQL DB, both structure and data, using PHPMyAdmin, with the option of exporting it as MSSQL compatible single file: mydb.sql

The resulting file is large (about 2GB).

I have a DB set up on a Microsoft SQL Server.

How do I import the mydb.sql file, into the Microsoft SQL Server? I installed the Microsoft SQL Server Management Studio, and was able to use it to connect to the Microsoft SQL Server, and connect to the DB, but I can't figure out how to use it to import mydb.sql, to create the table and data.

Any ideas?

EastsideDev
  • 6,257
  • 9
  • 59
  • 116
  • In SSMS right click on your DB -> Tasks -> Import flat file – Cid May 23 '19 at 08:07
  • @Cid I tried this, but it did not work. It was looking for .csv or .txt files, and when I entered the .sql file names, it was showing it as as a text file – EastsideDev May 23 '19 at 08:30
  • Possible duplicate of [Import MySQL database into a MS SQL Server](https://stackoverflow.com/questions/2621682/import-mysql-database-into-a-ms-sql-server) – Cid May 23 '19 at 08:51

1 Answers1

1
  1. Choose File->Open from SSMS menu.
  2. Pick your SQL file.
  3. Once the file is loaded be sure that you are in the context of your database.
  4. Click Execute button.
  • This kind of works. The file was imported, but when I tried to execute, it complained about bad syntax. This means that phpmyadmin did not export it in a format that's compatible with Microsoft SQL – EastsideDev May 23 '19 at 08:39
  • You should check phpmyadmin documentation. T-SQL syntax has been changed from version to version. There is an option on the database level in SQL Server called Compatibility Level and could be changed in order to ensure that you script executed without errors. Instead of clicking on "Execute" button, there is a "Parse" button as well. Check the syntax using this button. –  May 23 '19 at 08:49
  • I did select the MSSQL compatibility option in PHPMyadmin. I even tried the structure only. – EastsideDev May 23 '19 at 08:54
  • Did your selection match the database property on SQL Server? –  May 23 '19 at 08:58