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
 General SQL Server Forums
 New to SQL Server Administration
 manually scheduling a job

Author  Topic 

swathi3003
Starting Member

23 Posts

Posted - 2013-10-31 : 02:35:28
hi
Can i schedule a job manually.?? like i have a job that will be run every month on 'x' date..
is it possible to give 'x' from front end??

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-31 : 02:43:42
its possible
Get x from front end screen using .net code pass it to db code. In DB, execute sp_add_jobschedule to set schedule based on the passed value

http://technet.microsoft.com/en-us/library/ms366342.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

swathi3003
Starting Member

23 Posts

Posted - 2013-10-31 : 03:12:26
Thank U


actually i have a doubt

i pass the day from front end
and i hae written below code from backend

declare @day int = 19

EXEC msdb.dbo.sp_add_jobschedule @job_id=@job_id, @name=N'sch1',
@enabled=1,
@freq_type=16,
@freq_interval=@day,
@freq_subday_type=1,
@freq_subday_interval=0,
@freq_relative_interval=0,
@freq_recurrence_factor=1,
@active_start_date=20131031,
@active_end_date=99991231,
@active_start_time=0,
@active_end_time=235959,
@schedule_uid=N'72fc1ed3-e3b6-4289-a0dd-19a1fe7aaa33'


will it automatically updated to that job??
and the next time if i update the day
then what happen ??
Go to Top of Page

swathi3003
Starting Member

23 Posts

Posted - 2013-10-31 : 03:24:38
Can i update systables data from my application

like [msdb].[dbo].[sysjobschedules] has job schedule dates
what if i update next date?? then the job will be run on given date...

Im not sure whether it is suggestable or secured..

Im just asking..
Go to Top of Page
   

- Advertisement -