Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 calling a sql job from exe ?

Author  Topic 

jhermiz

3564 Posts

Posted - 2005-10-05 : 10:28:36
We have been putting a lot of band aids on our current labor system. Originally it was simply written by a company called Kronos, but because of our strange processes and job numbers we had to integrate it with our SAP system :|. Without going into too many details we have SAP shooting out a text file that is read in by Kronos to get labor data into a table. However, we are having issues so we had to write a seperate exe and create several jobs to get the data the way we liked it. In any event, I have an exe that does some looking for, copying, renaming, and moving. The only thing it does is basically that file manipulations and moving and renaming stuff around. After that thing runs we have a special sql job that runs some time after that. The job is run from the sql scheduler (the agent).

Here was the original process flow one of the managers sent:




New Process flow



Copy ZGPSIN0001_OUTBOUND_*.txt from \\pl1sap\PL1_120Export to \\hercules\Labor_Data\Downloads renaming the file to zgpsout.txt
Somehow check the file zgpsout.txt for the presence of the special line:
"PS0120XX-XX CXXXXXXXX





0000000000000000End of record"

If the line is in the file then go to step 4 and finish running the program, if it is NOT in the file then stop ALL phases of the import program and notify AD-C of the error.
Copy zgpsout.txt from \\hercules\Labor_Data\Downloads to \\hercules\SAPCommJobs renaming the file to SAPCommJobs.txt
Copy ZGCOIN0001_OUTBOUND*.txt from \\pl1sap\PL1_120Export to \\hercules\Labor_Data\Downloads renaming the file to zgcoout1.txt and zgcoout2.txt (As required)
Need steps from current SQL and EXE programs for this part
Need steps from current SQL and EXE programs for this part
Need steps from current SQL and EXE programs for this part
Need steps from current SQL and EXE programs for this part
Need steps from current SQL and EXE programs for this part
Run a compare using the SAPCommJobs.txt file that was loaded into a SQL table in step (6 or 7 or 8….) against the ShopTrac table. We need to check each job in the SAPCommJobs table against the ShopTrac table, matching the commission, activity and cost center. If we don't find a match export that record out to a new zgpsout.txt in the \\hercules\Labor_Data\Downloads folder.


In any event I would like to stop relying on all these schedules from different places such as one for the exe and one for the sql job. I would like my .exe file to call and manually run this sql job. I wish I could write this all as an sql script but my sql scripting is not as good as I'd like it to be. So basically my issue is and my question is, is it possible to run a regular job from my .exe file. If so does anyone have any sample code? The current application is in vb.net.

Thanks,
Jon


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-10-05 : 10:33:20
sql scripting: sp_startjob

from vb.net... well open a sql connection... and call the sp_startJob.... its in BOL

Corey

Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..."
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-10-06 : 06:57:21
quote:
Originally posted by Seventhnight

sql scripting: sp_startjob

from vb.net... well open a sql connection... and call the sp_startJob.... its in BOL

Corey

Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..."



ermmm...you're right
Go to Top of Page
   

- Advertisement -