Author |
Topic |
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 05:59:31
|
Hello all,Hoping someone can help me with the following issue. I need to send an alert if real time is within 30 minutes of a meeting stating i.eMeeting time 15:00Acutal time 14:00 If the actual time is beween 14:30 and 15:00 send alertThanks in advance |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-09 : 06:01:34
|
is this t-sql requirement?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 06:15:46
|
Yesthe logic is as follows@meetingTime = 15:00@actualTime = 14:45IF actualTime within 30 minutes of meeting timeBEGINreturn row of dataENDELSEprint message |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 07:03:58
|
I need something like this ;AND startdatetime BETWEEN DateADD(mi, -30, Current_TimeStamp) AND current_timestampbut it doesn't seem to work |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 07:27:55
|
This did the trick ;AND startdatetime > DateADD(mi, -30, Current_TimeStamp) hope it helps someone else |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 07:37:51
|
This works even better ;AND (startdatetime <= current_timestamp OR startdatetime > DateADD(mi, -30, Current_TimeStamp))i.e the meeting is either current and running or within 30 minutes of starting |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 08:03:07
|
I finally settled on ;AND (startdatetime <= current_timestamp OR startdatetime BETWEEN startdatetime AND DateADD(mi, -30, Current_TimeStamp))' |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 08:19:39
|
However, that didn't work as expected so i fixed it with ;AND (startdatetime <= current_timestamp OR startdatetime BETWEEN Current_TimeStamp AND DateADD(mi, +30, Current_TimeStamp))' |
 |
|
dhjackal
Starting Member
42 Posts |
Posted - 2011-12-09 : 08:19:59
|
|
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-09 : 08:35:16
|
is the last one equivalent of below?AND startdatetime <= DateADD(mi, +30, Current_TimeStamp) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|