mcintyre321's links look handy...
I used powershell to do something similar. I'd name all of my setup scripts with a prefix and a 1.x in whatever order they needed to be compiled.
I then named all my teardown scripts 3.x in the proper order.
The command in cmd window:
PS builddir:\> .\buildsql.ps1 -currentbuilddir "C:\Documents and Settings\SGreene\My Documents\svn\Ticketing" -buildfile "sqlbuild.sql" -teardownfile
"teardown.sql"
The powershell script (buildsql.ps1)
param($currentbuilddir,$buildfile1,$teardownfile)
new-psdrive -name builddir -PSProvider filesystem -Root (resolve-path $currentbuilddir)
cd builddir:
rm $buildfile1
rm $teardownfile
Get-item COM_ENCRYPT_1* | ForEAch-object {cat $_ >> $buildfile1; "GO --SYSTEM INSERTED GO--------------" >> $buildfile1}
Get-item COM_ENCRYPT_3* | ForEAch-object {cat $_ >> $teardownfile; "GO --SYSTEM INSERTED GO------------" >> $teardownfile}
My first time doing this, but it seemed to work OK.