Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Having a SQL job constantly run

Posted on 2011-02-21
4
Medium Priority
?
264 Views
Last Modified: 2012-05-11
Is it possible to program a SQL job to run constantly?  I have a very simple SQL update script that I would like to have run as a job, literally, every second.  Unfortunately, it appears that the most that SQL can do is to run a job every 60 seconds.
0
Comment
Question by:apitech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Expert Comment

by:rajvja
ID: 34943195
Hi,

   Are you sure that you want to run for every second????
Establishing the connection and execute statement will take a while(typically more than a second).
And also burden on server if you run like that
0
 
LVL 4

Expert Comment

by:rocky_lotus_newbie
ID: 34943330
If you are convinced, you need to run it every second - There is an alternative, to include the script in an infinite while loop (while 1=1) with a Waitfor command (SYNTAX: WAITFOR DELAY '000:00:01').

This does not run the script for every second but will ensure that there is a time gap of 1 ssecond between successive executions.

Please consider implementing this only if you think it meets ur requirements as running something for every 1 second is not advisable.

Thanks,
0
 
LVL 1

Author Comment

by:apitech
ID: 34943733
Hi rocky_lotus_newbie:

I don't mind a gap of one second.  If I use the syntax that you used, such as WAITFORDELAY '000:00:01', would that do what you're suggesting (i.e. have a gap of one second) and allow for a safe run of my script?
0
 
LVL 4

Accepted Solution

by:
rocky_lotus_newbie earned 2000 total points
ID: 34944149
Yes, Below is the Syntax. Make sure you test it few times before implementing.

while (1=1)
BEGIN
-- Write your Query/Script here
WAITFOR DELAY '000:00:01'
END
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question