Sql-server – How to handle HUGE 16GB SQL file

bulk-insertinsertMySQLsql server

I've abc.sql file exported from MySQL Table.
This abc.sql file is 16 GB in size with around 28 million insert statements.

I'm looking for option to store it in SQL Server Database.

Couple of questions:

  1. How to open 16GB file?
  2. Is it possible to load 28 Millions Insert statements from MySQL to SQL Server?

Best Answer

I have come across a similar problem once when importing a 5GB SQL file. Most editors max out at 256mb or 512mb, the only editor I know of (on windows) that can open files in the GBs without issues is emEditor (there's a trial version). My old rig with 8GB of RAM (twice as much as yours but most of it was used up to 80% the entire time) and ~20-25 GB of free space on C drive could open it in ~2minutes (keep in mind my hardware was extremely old DDR3 with gen2 or gen3 i7 processor and slow drives).

The biggest selling point (even if you have to wait for it to load) is being able to view the schemas and the code in case the export didn't include DDL for the tables (which was the case in my scenario).

Depending on the exporting tool used, your insert statements might have ` for strings instead of ', thankfully using the emEditor you can replace all of them with '. This will allow you to import your code into SQL Server without issues.

The way I solved it was by modifying the file so it can be natively imported into SQL Server and use SQL CMD to run the script file.