Hello All!
I know there must be a way to do this, just not sure how.
So I have a table called tblSchedule. It has a column called REALDATE, in SMALLDATETIME format.
So a value for this would be 7/21/2008 10:50:00 AM.
So this is the scheduled time for a connection.
CODE
DECLARE @DELAY varchar(30)
SELECT @DELAY = DATEADD(minute, -20, REALDATE)
FROM tblschedule
WHERE [DATE] = '7/21/2008' AND REALDATE > CAST(GETDATE() AS nvarchar(30)) AND CNID = '6'
PRINT @Delay
So this returns 'Jul 21 2008 10:30AM'
So what I want to do is, if CNID "6" connection is attemptempted 20 minutes before 10:50, return a value. So only between 10:30 and 10:50 this should fire, if it's before or after that, is should return no value.
Now I have this as the last part of my code.
CODE
SELECT REALDATE, CNID
FROM TBLSCHEDULE
WHERE [DATE] = '7/21/2008' AND @DELAY < CAST(GETDATE() AS nvarchar(30))
The problem I have is the greater or less than sign doesn't have a limit.
The above is return a value where '10:30' is less then Current TIME.
But when my Current TIME is 10:51, it is still going to return a value. I need it to only return a value between 10:30 and 10:49.
I hope this makes sense, I'm getting confused just explaining it.
Thanks
Rudy
This post has been edited by RudyVB.net: 21 Jul, 2008 - 08:43 AM