Distribute A Stored Procedure

  • I am trying to distribute a stored procedure to the master database on all servers using the ISQL command at the DOS prompt where the stored procedure is. I wonder if someone could help me with the correct syntax of the isql command. Thank you! I don't mind doing one server at a time. But any automation suggestions would also be greatly appreciated.

  • Here is the command I came up with:

    isql /S servername /U sa /P password /Q "exec sp.sql"

    I am getting: Could not find stored procedure 'sp.sql'.

    Did I miss something? I am executing the command in the directory where the sp.sql exists. How do I execute that stored procedure against the target server? Any assistance would be appreciated. Thank you.

  • HELP! HELP!

  • In your example you are trying to run the procedure not create it. What you need to do is create a text file containing the create procedure and associated details (could extract from existing database first) then you can use isql

    isql /S SERVERA /U username /P password -d database -b /m-1 /i textfilename
    
    if ERRORLEVEL 1 pause
    isql /S SERVERB /U username /P password -d database -b /m-1 /i textfilename
    if ERRORLEVEL 1 pause
    isql /S SERVERC /U username /P password -d database -b /m-1 /i textfilename
    if ERRORLEVEL 1 pause

    this will process the textfile (list of sql) in each server and stop if error occurs (pause).

    This is how I control all my procs across my servers. ie using .bat file

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

  • Thank you, David, for the helpful instructions. It worked!!!

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

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