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 2005 Forums
 SQL Server Administration (2005)
 Job Scheduling

Author  Topic 

vaidya
Starting Member

4 Posts

Posted - 2007-10-22 : 09:01:43
Hi,

Is it possible to input values to a sql job so that the sam ejob runs for different parameters i.ee the same job runs for X on all 7 days o a week and for Y only on all weekdays...

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-22 : 09:04:22
moved from script library

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-22 : 22:18:08
Create separate job.
Go to Top of Page

vaidya
Starting Member

4 Posts

Posted - 2007-10-23 : 01:50:18
I suppose i need to rephrase my question...

We have a list of clients for which we need to generate a data extract..

Some clients may need the Sql job (that extracts data) to be run on all weekdays or on all days including week ends or on specific days in a week.

We have a list of about 40 clients for which we need this extract to be created..

We have coded the stored proc whcih will generate this extract but will have to wrap this in a sql job which woud run according to the above condition.

How do we go about this??
Go to Top of Page

crosan
Starting Member

13 Posts

Posted - 2007-10-23 : 09:28:57
Will something like this in your job step work?

DECLARE @sqlstmt nvarchar(50)

SET @sqlstmt =
CASE DATENAME(dw, getdate())
WHEN 'Saturday' THEN 'sp_YourWeekendStoredProc'
WHEN 'Sunday' THEN 'sp_YourWeekendStoredProc'
ELSE 'sp_YourWeekdayStoredProc'
END

EXEC sp_executesql @sqlstmt
Go to Top of Page

vaidya
Starting Member

4 Posts

Posted - 2007-10-23 : 10:07:26
Hi Crosan,

Thanks for your input...

Apart from running the weekendSP and weekdaySP on different days, i also need to run it for different clients...

We already have these SPs in place and these Sps take client id, start date and end date as parameters.

How can one go about this.?
Go to Top of Page

crosan
Starting Member

13 Posts

Posted - 2007-10-23 : 10:51:32
How do you determine if a particular client needs to be run for either a weekend or a weekday?
Go to Top of Page

vaidya
Starting Member

4 Posts

Posted - 2007-10-24 : 01:31:47
Hi,

That logic needs to be put in place..perhaps we could have a look up table which tells on which day a particular client could run....That's what i was thinking of...

You have any ideas on how to go about this?
Go to Top of Page
   

- Advertisement -