Home Forums Programming Connecting Execute a sql job from AS400 command line RE: Execute a sql job from AS400 command line

  • Here is my example:

    RUNRMTCMD CMD('sqlcmd.exe -S "MY-SQL-SERVER" -Q "execute msd

    b.dbo.sp_start_job @job_name = ''TestOnly'' "

    >> C:\temp\temp.txt')

    RMTLOCNAME('MYPC.THSU.COM' *IP)

    RMTUSER('thsu')

    RMTPWD('mypassword')

    Results in temp.txt:

    Job 'TestOnly' started successfully.

    TestOnly job history showed "The job succeed"

    Hope this helps.

    BTW, I use Windows Authentication in SQL server.

    -Tom