View Full Version : Combine sql Queries

01-04-2014, 12:05 PM
Simple, short, sweet tutorial on how to combine sql queries.

Open command propmt.

Browse to location of all queries you wish to combine.
-To change locations in command propmpt use the command
cd .. to go up, or
cd C:/Trinity/sql/INSERT_FOLDER_NAME_HERE and continue to the folders destination through any sub-folders you have created.

Then execute the following command(s) based on your OS.

For Windows

copy *.sql update.sql

For Linux

cat *.sql > update.sql

Change the update.sql to the desired name of the sql file you wish it to be saved as.

Google for translating the commands for linux

01-04-2014, 05:39 PM
Thanks for the small guide.

01-16-2014, 03:40 AM
On windows you can have the directory open then shift right-click and choose to open the cmd prompt in that directory. Just to save some typing :p

01-16-2014, 03:46 PM
nice guide, i go tired of doing this myself (call me lazy if you like). so i chose this route:

make a new text file and put this in it:

copy *.sql all.sql

save it as a merge sql.bat. once that is done just copy/paste it to the folder where the sqls you want to combine are, run it, and presto all sqls are in one file called "all".

note: you can change the output name by editing the "all.sql" to "whateveryouwant.sql"

just remember not to delete the merge sql.bat just copy/paste it from a safe place, or you need to start all over (at that point you might as well just follow Zulku's and Parranoia's method)

i suppose i should mention this is for windows, but i would assume the linux command would work in the same manner