home

-- Create database script
Author Nigel Rivett
This creates a single script file from many files.
It expects the database to have a root directory with the various sub-directories for objects.
This example will create a single script by concatenating the individual stored procedure scripts.
To run this procedure the code below should be saved into a .cmd file in the database root directory.

This code could also be generated by tsql to save typing in all the file names.



ECHO use DBNAME > "procs_DBNAME.sql"
set fname=
set fdest=..\procs_DBNAME.sql

cd Procs
ECHO print 'Procs' >> "%fdest%"

set fname=proc1.sql
	ECHO. >> "%fdest%"
	ECHO print 'processing file - %fname% ' >> "%fdest%"
	TYPE "%fname%" >> "%fdest%"

set fname=proc2.sql
	ECHO. >> "%fdest%"
	ECHO print 'processing file - %fname% ' >> "%fdest%"
	TYPE "%fname%" >> "%fdest%"

set fname=proc3.sql
	ECHO. >> "%fdest%"
	ECHO print 'processing file - %fname% ' >> "%fdest%"
	TYPE "%fname%" >> "%fdest%"

ECHO. >> "%fdest%"


home