Running Multiple SQL Files

  • I have several SQL scripts that update the stored procedures required by my application.

    Because the app requires so many sps, I have grouped them into separate files by function as it makes it easier to maintain.

    Is there any way I can write a transact sql script to open each of the files and execute them as a batch rather than having to manually open each file?

    Or does anyone know of another tool I can use instead?

    TIA

    Squirrel

  • I put all my procs in separate files and use ISQL on the file I want to update my database(s). You can put several ISQL commands in a batch file with error checking if you want to do several scripts in one go.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • I hate to sound completely thick, but what is ISQL?

    Any chance of an example of how I could do this and what would need to go in the batch file?

    Thanks

  • I hate to sound completely thick, but what is ISQL?

    Any chance of an example of how I could do this and what would need to go in the batch file?

    Thanks

  • ISQL & OSQL are the DOS batch file equivalent of ISQL (aka QA Query Analyser)

    use

    ISQL -S servername -U username -P password -d database -b -m-1 -i scriptfilename

    if ERRORLEVEL 1 pause

    -b is 'On error batch abort'

    -m-1 is 'errorlevel'

    the if test is to stop the batch file in case of an error so you can see the results.

    Have fun.

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply