Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Execute a sql job from AS400 command line Expand / Collapse
Author
Message
Posted Friday, March 1, 2013 9:27 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 27, 2013 7:57 AM
Points: 7, Visits: 10
When we run the command we get the .txt on the SQL server but it is empty.
If we try to run RMTCMD to just do a regular copy file from one folder to the other it is working. However as soon as we do SQLCMD. It doesn't work. We tried doing a sql command just to run a select * from table and this doesn't work. Is there something that needs to be installed on the AS400 or some rights that I am not aware of.
Post #1425579
Posted Monday, March 4, 2013 2:47 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, January 15, 2014 4:51 PM
Points: 4, Visits: 37
I don't remember exactly what I did with that project years ago.
But I am sure that no need to install anything extra on AS400.
If you directly run SQLCMD from Windows command prompt, it should give you error message to diagnose.
Post #1426471
Posted Monday, March 4, 2013 5:09 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Sunday, July 27, 2014 12:14 PM
Points: 3,433, Visits: 14,423
thsu (3/4/2013)
I don't remember exactly what I did with that project years ago.
But I am sure that no need to install anything extra on AS400.
If you directly run SQLCMD from Windows command prompt, it should give you error message to diagnose.


It would be nice if you remember the year because an Agent Job after an EDI between SQL Server and AS400 can be payroll transaction so running it with the simple test example may not be relevant to the actual task needed.


Kind regards,
Gift Peddie
Post #1426528
Posted Tuesday, March 5, 2013 6:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, November 27, 2013 7:57 AM
Points: 7, Visits: 10
Thanks. We got it to work. We used the RMTCMD command to call a .bat. The main issue is that we had to use OSQL instead of sqlcmd which is weird because we are on SQL 2005.

This is the .bat

osql -U sqluser -P sqlpassword -S server -Q "EXEC msdb.dbo.sp_start_job N'JOB NAME'" .

Also we has to change the user and password for the RMTCMD because it is different than the sql user and password.

Thanks for your help.
Post #1426786
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse