Categories
Merging multiple sql files
This article explains how to merge multiple .SQL files into 1 .sql file. This is a huge time saver in some situations, since both SQLyog and MySQL workbench do not support importing multiple .sql files at once.
Before starting the article, it is advisable to put all your .sql files you want to merge into a folder or directory. As the following example, this was done briefly in a folder within the Downloads folder.
Then you can open a CMD or command prompt and navigate to the folder you just created. This is done in the following way with the command: cd "folder"
After this, enter the following command to merge all the files with .sql into 1 file:
for %F in (*.sql) do ( type %F >> merged.sql )
Which you can execute in the following way:
After this you will see a new file in the same folder within explorer, which you can then import at once within SQLyog or MySQL Workbench.
So this is a simple command you can use to merge multiple .SQL files into 1 file to import at once.