Execute Stored Procedure via .bat file

  • Hi

    I have a stored procedure that restores a database based on the database name that gets passed

    as a parameter. I can execute this stored procedure in osql or dos by providing this command in dos

    osql -E -Q "execute master.dbo.RestoreDBFromBackup 'test1'", however when i save this command to a .bat

    file then thereafter double click the bat file it won't work. How do I get to execute this

    restore command from a .bat file?

    Your response regarding my question will be highly appreciated

  • We use perl... to run from .bat file.

    perl is free.

    Pl. let me know if want more info.

    HTH.

    Thanx.

    Vinay

    Thanx.
    Vinay

    http://rdbmsexperts.com/Blogs/
    http://vinay-thakur.spaces.live.com/
    http://twitter.com/ThakurVinay

  • Hi Vinay thanks for the response

    Do you have an alternative suggestion. I deally I wouldn't wan't to use pearl

  • I tested and its working.....

    make the .bat file as

    isql /S /U sa /P /d /i

    create another query.txt file where you call the sp... as

    exec usp_Vinay

    HTH.

    Vinay

    Thanx.
    Vinay

    http://rdbmsexperts.com/Blogs/
    http://vinay-thakur.spaces.live.com/
    http://twitter.com/ThakurVinay

  • Thanks very much Viney...its working perfectly!

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

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