Running a script using "osql"

  • Dear All,

    I have the following situation:

    I have an application where my users are using MSDE 2000 as their DB and a VB6 interface.  Periodically the users connect to a main server (SQL Server 2000) from where they download via FTP any SQL scripts needed in order to update their DB.  These scripts are run using the "osql" utility (the actual command is : osql -S <ServerName> -U <UserName> -d <DB_Name> -P "<Password>" -i "<FileName>".  This process is not visible to the user which means there is no indication if something goes wrong.  If a statement in my script fails it goes on to the next statement and I have no way of knowing if everything was OK.

    Does any one have an idea as to how I should approach this matter in order to make sure tha if anything goes wrong I notify the user somehow ...

    Thanks,

    Andreas

  • Have your script file update a log file. Before executing the next step in your program, check the log file to make sure log says the script ended sucessfully. I had a solution a few years back that did this, and seemed to work fine.

    It may be a good idea to see if you can achieve the same thing using DTS. If you need a command line solution, you can use dts run to run any DTS package you create.

    HTH


    Mathew J Kulangara
    sqladventures.blogspot.com

  • You could also embed the OSQL command in a Batch file that could provide instant gratification as to the outcome...

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

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