|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 6:28 AM
Points: 7,
Visits: 9
|
|
I am trying to use this command to execute a sql job from an AS400 command line. I am having trouble getting it to work. It doesn't say that the job started. It just says 'The remote command has produced no output'. I am running this:
RUNRMTCMD CMD('sqlcmd -U user -P password -S server name -Q "msdb.dbo.sp _start_job @job_name = ''FACT852: ProcessRetailSales'', @server_name = '' server''"') RMTLOCNAME('99.99.99.99' *IP) RMTUSER(user) RMTPWD(password)
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 29, 2013 11:17 AM
Points: 3,432,
Visits: 14,332
|
|
vconlan (2/26/2013) I am trying to use this command to execute a sql job from an AS400 command line. I am having trouble getting it to work. It doesn't say that the job started. It just says 'The remote command has produced no output'. I am running this:
RUNRMTCMD CMD('sqlcmd -U user -P password -S server name -Q "msdb.dbo.sp _start_job @job_name = ''FACT852: ProcessRetailSales'', @server_name = '' server''"') RMTLOCNAME('99.99.99.99' *IP) RMTUSER(user) RMTPWD(password)
I have not used it for a while but you can use stored procedure to execute the job but admin permission is required for both SQL Server and AS400.
Kind regards, Gift Peddie
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 6:28 AM
Points: 7,
Visits: 9
|
|
| I have and EDI process on my AS400 and at the end of that process I need to call a sql job. However we can't get it to work.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 29, 2013 11:17 AM
Points: 3,432,
Visits: 14,332
|
|
vconlan (2/27/2013) I have and EDI process on my AS400 and at the end of that process I need to call a sql job. However we can't get it to work.
Then you can create SSIS package that can run both or create a job steps that runs both.
Kind regards, Gift Peddie
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 1:26 PM
Points: 4,
Visits: 32
|
|
You can add >> c:\temp.txt to redirect the command output to check if the job started successfully. Also make sure the user is a member of SQLAgent*Role in msdb.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 6:28 AM
Points: 7,
Visits: 9
|
|
I'm sorry I am confused.
I need to initiate this on the aS400. I am trying to use this command. Does this command not work?
RUNRMTCMD CMD('sqlcmd -U user -P password -S server name -Q "msdb.dbo.sp _start_job @job_name = ''FACT852: ProcessRetailSales'', @server_name = '' server''"') RMTLOCNAME('99.99.99.99' *IP) RMTUSER(user) RMTPWD(password)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 1:26 PM
Points: 4,
Visits: 32
|
|
| In fact, you can try to directly run the command on the server (your RUNRMTCMD destination) to see if it starts the SQL job.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 29, 2013 11:17 AM
Points: 3,432,
Visits: 14,332
|
|
thsu (2/28/2013) You can add >> c:\temp.txt to redirect the command output to check if the job started successfully. Also make sure the user is a member of SQLAgent*Role in msdb.
That will not work for IBM AS400 because since 2005 admin permissions in both IBM and Microsoft is required for most automation solutions to work.
Kind regards, Gift Peddie
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 1:26 PM
Points: 4,
Visits: 32
|
|
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
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 6:28 AM
Points: 7,
Visits: 9
|
|
| Thanks I will see how this works.
|
|
|
|