SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 calling a sql job from exe ?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

jhermiz
Flowing Fount of Yak Knowledge

USA
3564 Posts

Posted - 10/05/2005 :  10:28:36  Show Profile  Visit jhermiz's Homepage
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 -- http://www.web-impulse.com
Imperfection living for perfection --
http://jhermiz.blogspot.com/

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 10/05/2005 :  10:33:20  Show Profile  Visit Seventhnight's Homepage
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
Flowing Fount of Yak Knowledge

USA
3564 Posts

Posted - 10/06/2005 :  06:57:21  Show Profile  Visit jhermiz's Homepage
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

Edited by - jhermiz on 10/06/2005 07:03:19
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000