Running a job in SQL 2005 by calling a batch file from a As400 CL program

5 pts.
Microsoft Windows
Patch management
SQL Server
Hi, I already asked this question before but did not get any reply. Anybody please help.. I am calling a job on AS400 which uses RUNRMTCMD to execute a batch file on sqlserver 2005 server. This batch file uses sqlcmd command to run a job on sqlserver. When I execute this batch file manually from this sql server computer it works fine. But when I am trying to run it thru the AS400 job it doesn't work. When I created a test batch file which runs thru the AS400 job but doesn't use the sqlcmd command and tried to run that batch file from the sql server computer thru calling the AS400 job that works fine.The remote login used in the AS400 program has all the administrative rights and I tried tp logon as this login and try to execute that batch file locally , it works fine. Please help. Thanks in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Need more information. Need to see an example of the commands that your are trying to pass through the runrmtcmd.

Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Gullu1
    Thanks for your reply TonyRa. Here are the informations: The As400 CL program is like this: PGM RUNRMTCMD CMD('C:BATCHESWWW03W.BAT') RMTLOCNAME('IP_address of the sql 2005 computer' *IP) + RMTUSER('userName') RMTPWD('Password') ENDPGM The batch file is like this: sqlcmd -S Ip_address -d msdb -U user_name -P password -i "c:batchesWWW03W_input.txt" -o "c:batchesWWW03W_output.txt" The input file is like this: sp_start_job @job_name = "Impt_WWW03W_ODBC" Inside the batch file if I write some non-sql commands like copy file . It works. Thank you !
    5 pointsBadges:
  • DeadMeatinLA
    Might be a minor point... but when I key some values into the RUNRMTCMD command in the source file editor on the iSeries the RMTUSER field and the PWD field do not have single quotes around the entries.
    0 pointsBadges:
  • Gullu1
    Thanks for your reply DeadMeatinLA. But this CL program works fine with our SQL 7 server. Just does n't work for SQL 2005. Also if I include some non-sql command in the batch file like copy file and call this program it works. It does n't execute the sql command to run this job. Thank you..
    5 pointsBadges:
  • TomLiotta
    When you logon to the SQL 2005 system (actually on the system, not through any remote database connection), is the user defined on that PC and do you logon to the PC? Or is the user logging on to the network? I.e., is that user only defined as a local user? If a user of the same name is defined on the PC and on your network, be sure they're not being confused when you sit down at the PC to test the logon. Then, is that user (the local PC user) authorized in the SQL 2005 database? Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: