start job from batch file, dos

  • Hey all,

    What's the command for starting a SQL 2005 job from the command line or batch file?

    I've been searching BOL (which now seems to be part of MSDN and not as good as it was) MSDN2's site and Google for hours. Anyone know?

    OT: Are other folks finding it really hard now to find info on SQL 2005, SSIS, Agent et. al.?

    thanks a million.

    Skål - jh

  • Try this:

    sqlcmd -d msdb -Q "execute sp_start_job 'job_name'" -S server_name -E

    I also used osql instead of sqlcmd, works exactly the same.

  • Will try it out, thanks a million.

    Skål - jh

  • Hmmmm, I only get

    'sqlcmd' is not recognized as an internal or external command,

    operable program or batch file.

    I have the full 2005 installed, is sqlcmd a seperate install now?

    Skål - jh

  • sqlcmd is a new version of osql for 2005. osql is also supported for backward compatibility. As I mentioned before, you can use osql and in my case it worked exactly the same as sqlcmd.

    About sqlcmd, no it's not a separate install. You should probably check new configuration tools in 2005: Configuration manager and Surface Area configuration ( that's besides sp_configure). In my machine, sqlcmd.exe as well as osql are installed in C:\Program Files\Microsoft SQL Server\90\Tools\Binn, so you can check that folder.

  • Ah, thanks!

    Skål - jh

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

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