CHECK IF COMMAND IS PRESENT MORE THEN 10 MINUTES in stored procedure [Resolved]

Posted by Sudhakar_A under PostgreSQL on 8/11/2014 | Points: 10 | Views : 1649 | Status : [Member] | Replies : 1
DECLARE @DATETIME DATETIME

SET @DATETIME = (SELECT RecCreatedDate
FROM CP_InOutMsgHandlerLive(NOLOCK)
WHERE UnitNumber = @UnitNumber)

--CHECK IF COMMAND IS PRESENT MORE THEN 10 MINUTES.
IF @DATETIME < DATEADD(MI,-2, GETDATE())

does the above if condition is correct to CHECK IF COMMAND IS PRESENT MORE THEN 10 MINUTES in a table
(CP_InOutMsgHandlerLive)




Responses

Posted by: Bandi on: 8/11/2014 [Member] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
DECLARE @DATETIME datetime= '2014-08-11 18:00:00' --Suppose GETDATE() is '2014-08-11 18:09:19.397'
IF GETDATE() <= DATEADD(MI, 10, @DATETIME)
SELECT 'Commande is created More than 10 Min'
ELSE
SELECT 'Commande is created less than 10 Min'


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sudhakar_A, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response