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?

3
  • In SSMS right click on your DB -> Tasks -> Import flat file Commented May 23, 2019 at 8: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 Commented May 23, 2019 at 8:30
  • Possible duplicate of Import MySQL database into a MS SQL Server Commented May 23, 2019 at 8:51

1 Answer 1

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.
Sign up to request clarification or add additional context in comments.

4 Comments

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
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.
I did select the MSSQL compatibility option in PHPMyadmin. I even tried the structure only.
Did your selection match the database property on SQL Server?

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.