Link to home
Start Free TrialLog in
Avatar of apitech
apitech

asked on

Having a SQL job constantly run

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.
Avatar of rajvja
rajvja
Flag of United Kingdom of Great Britain and Northern Ireland image

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
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,
Avatar of apitech
apitech

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of rocky_lotus_newbie
rocky_lotus_newbie
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial