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 2008 Forums
 Transact-SQL (2008)
 Create scheduled job running every week

Author  Topic 

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2012-03-30 : 08:23:25
Hi all,

not sure whether this is a question for T-SQL or for Admin:
I need a scheduled job running every 30 seconds on every sunday between 20:00 and 20:15. I've checked MSDN and found some information regarding the scheduler but I'm not sure about the best option, e.g. creating 30 schedules running every week, first one at 20:00:00, second one at 20:00:30 etc. Or using T-SQL to change the next run time once the job is completed. Or several other options.
What would be the preferred way?
Many thanks in advance!

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-30 : 09:57:52
ummm...no...just create 1 job and look at the scheduling options



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2012-03-30 : 10:09:28
Hi Brett,

I did so but could not find it. So it should be possible to create a schedule running every sunday every 30 seconds between 20:00 and 20:15? OK, I'm going back to MSDN now ......
Thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-30 : 17:39:10
its possible in sql server agent. you've option to set a schedule which repeats every 30 seconds and can give start and end time for that.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2012-03-31 : 02:22:07
OK, thanks! I've checked now but I could not find a Server Agent option, even after enabling the service. It seems that Server Agents are not available in SQL 2008 R2 Express Edition? Would this one then be the best option? http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express It's for SQL 2005 so I'm not sure whether this is also a good solution for 2008.
Thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-31 : 19:33:56
quote:
Originally posted by Heinz23

OK, thanks! I've checked now but I could not find a Server Agent option, even after enabling the service. It seems that Server Agents are not available in SQL 2008 R2 Express Edition? Would this one then be the best option? http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express It's for SQL 2005 so I'm not sure whether this is also a good solution for 2008.
Thanks!


Oh didnt realise you're using express
SQL agent is not available in Express edition


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2012-03-31 : 20:19:03
You can download free scheduling software that allows by interval, then just create a batch to run the sql from the command line. It's not ideal, but it should work for you.

If you are familiar with how to write code in .net there are a few scheduling library's I use that are free. Let me know if you want web links to download. IF you do not know how to write in .net, just google "Free Scheduler interval" and you should get something.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2012-04-01 : 02:47:27
@visakh16,
sorry, I did not mentioned before that I use Express. Now I've added it to my signature.

@Vinnie881,
my application is in asp.net so I know .net very well. I would be happy if you have some tools you recommend and / or use on your own

Thanks alot!

MS SQL 2008 R2 Express Ediiton
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2012-04-01 : 10:30:03
It's on the server at the office, so I'll get it for you monday.

There are two approaches Batch (OSQL) or write the db call in .net, I built a scheduler GUI that allows you to set interval and everything else for .net so the only modification to the code is to put a .start(MYSQLBATCHFILE.bat) in the tick event, or you can put the code to query the database/call a proceduere from the program itself.

Although the .net schedulers work well, if this is a mission critical environment, I would still upgrade and use sqlagent if it's a option.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-01 : 10:44:25
this is another alternative
http://www.sqlteam.com/article/scheduling-jobs-in-sql-server-express

or this

http://www.codeproject.com/Articles/15407/SQL-Agent-A-Job-Scheduler-Framework

actually there are lots of it available, if you just search for it


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Heinz23
Yak Posting Veteran

84 Posts

Posted - 2012-04-01 : 14:38:02
@khtan,
I've already posted your first URL in one of my previous postings, see above. But this is from 2005 and I'm not sure whether there is a better solution for 2008, and I always prefer if a user could recommend a solution which he uses.

--------------------
MS SQL 2008 R2 Express Edition
Go to Top of Page
   

- Advertisement -