Page 1 of 1

Concatenating files for MS SQL Server Script

Posted: Mon Jun 23, 2008 12:31 pm
by fohrman
Greetings --

We need to essentially run the same MS SQL script twice when we run the install... the only difference is the first few lines of the file.

The first time it needs to run <Static Lines 1> + <Dynamic Lines 1>
The second time it needs to run <Static Lines 2> + <Dynamic Lines 1>

We know all of these at compile time. We'd like to make this as convenient as possible. One way we could do it is to have a DOS batch file that creates these, but we're wondering if there's a better way.

Thanks in advance for any advice.

Posted: Tue Jun 24, 2008 8:30 am
by jimo
I use "Write to Text File" and the from the installer I run sqlcmd or osql.exe against the script I just created.

Posted: Tue Jun 24, 2008 10:42 am
by fohrman
Thanks, Jim, that makes complete sense.