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.
Author |
Topic |
propanecan
Yak Posting Veteran
60 Posts |
Posted - 2007-04-17 : 21:28:26
|
I'm trying to use a script that will only execute between the hours of 6am and 6pm. The statement is as follows: IF DATEPART (HOUR, (GETDATE())) BETWEEN 6 AND 18 BEGIN TRANSACTIONThe command seems to execute regardless of what time it is. Any ideas? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-17 : 22:06:29
|
enclose it in BEGIN . .. ENDIF DATEPART (HOUR, (GETDATE())) BETWEEN 6 AND 18BEGIN <your script here>END KH |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-04-17 : 22:09:18
|
what exactly are you trying to do? You could create a job and schedule it to run appropriately. A script like this will run when you execute it but not on a recurring basis..************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|