Setting up a database from source control: 01-schema.sql, 02-tables.sql, 03-indexes.sql, 09-seed.sql. To hand it to a colleague, or to run it on a fresh server, the fragments have to become one script - in the right order.
Download free trialBuy TextMerger
GO line for SQL Server batches)..sql file.
File names are a poor substitute for order. 10- sorts before 2- if the prefixes are not padded, and a fragment added later lands at the end alphabetically rather than where it belongs. Dragging the list puts the files where they have to run, and saving the list as a session means the next release of the database merges in exactly the same order, without redoing it.
It concatenates and nothing more: it does not parse SQL, does not check syntax, and does not know that a batch separator is needed for a particular database. A comment opened in one fragment and closed in another is still open where the files meet - so keep fragments self-contained. What it does guarantee is that line breaks, encoding and layout come through unchanged, so the merged script is the fragments, not a rewritten version of them.
Schema and seed data are rarely something to upload to a stranger's server. TextMerger is a desktop application for Windows, Linux and macOS: the files never leave your computer, and there is no size limit on the merge.
Going the other way - cutting a big .sql dump into separate files per table: SQLDumpSplitter. Loading data into the database after the schema is in place: FileToDB. Full reference: merging text files.