Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2004-12-24 : 13:32:24
|
| Anyone have a way to chain together multiple *.sql files so they'll execute in sequence?Sam |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-24 : 15:48:44
|
| Well you can just have multiple osql commandstype c:\mydir\*.sql > c\myscript.txtwill concatenate them but I prefer a bat file to produce itset fname=set fpath=set fdest=script.sqlecho use mydb >> "%fdest%"echo go >> "%fdest%"echo. >> "%fdest%"echo print 'Tables' >> "%fdest%"set fpath=Tables CALL :concat "%fpath%" "%fdest%" file1.sql CALL :concat "%fpath%" "%fdest%" file2.sqlecho print 'Views' >> "%fdest%"set fpath=Views CALL :concat "%fpath%" "%fdest%" file3.sql CALL :concat "%fpath%" "%fdest%" file4.sqlgoto :end:concat echo. >> %2 echo print 'processing file - %3 ' >> %2 type %1%3 >> %2:end==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2004-12-24 : 19:49:58
|
| Thanks Nigel and Happy Holidays... !!! |
 |
|
|
|
|
|