Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Hi,


I have created a job and schedule it on daily basis on 11:00AM.

I have taken parameters also from user i.e Start date, End Date, Days: mon,tus,wed...

but don't know how to schedule dynamically as per user input dates and days.

Example:
Start Date: 2015-12-23 00:00:00.000,
End Date: 2015-12-28 00:00:00.000,
Days : Friday,Sunday

Schedule Job only on Friday,Sunday between defined Start Date and End Date.

Thank you..

-Aniket Mali
Posted
Updated 21-Dec-15 19:22pm
v2

1 solution

Hi, The below system sp can do:

SQL
exec sp_add_jobschedule @job_name = @job,
@name = 'MySchedule',
@freq_type=1,
@active_start_date = @startdate,
@active_start_time = @starttime



Also refer to the link: https://www.mssqltips.com/sqlservertip/3052/simple-way-to-create-a-sql-server-job-using-tsql/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900