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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Job Step Processing based on Schedule

Author  Topic 

danedickey
Starting Member

6 Posts

Posted - 2006-05-15 : 14:31:17
I have a job that pulls the "previous day's" data from a DB2 linked server. The DB2 database has a maint window on Thursday (6-9 PM) and Friday (9 pm - 3 am) evenings. I have set up the job to run under 1 of 3 different schedules.
1) Run @ 9:00 PM on Sat, Sun, Mon, Tues, Wed
2) Run @ 9:30 PM on Thusday
3) Run @ 3:30 AM on Saturday

The job steps call SProcs, determining and passing in the date range to pull from the DB2 database. Schedules 1 & 2 use one set of logic to determine the dates, while schedule 3 would need to use a different set of logic. Is there a way within the T-SQL in a job step to find out which schedule it is running under for that instance?

Thanks
Dane

Dane Dickey

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-05-16 : 03:45:56
A bit confusing Dane

you want to know if the sproc is ran by which job schedule?

you can add a new table, add fields like sprocname, date_ran, date_completed (if you need duration)

before start calling sprocs, fill up the table with sprocname and date_ran and date_completed after the sproc finishes its task

or you can do it inside the sproc, by logging in the time it was ran or check master..sysprocesses for your job, job start, etc....

HTH



--------------------
keeping it simple...
Go to Top of Page

danedickey
Starting Member

6 Posts

Posted - 2006-05-17 : 15:38:27
Sorry for the confusion - I am not looking to track when the step or SProc was executed (past tense). I want to be able to determine during each job step, as it runs, what schedule context I am running under, and make decisions about what date values to pass as input parameters to the SProc being called in the executing job step.

HTH
Dane

Dane Dickey
Go to Top of Page
   

- Advertisement -