Hi, I am new to this forum please help.
I need to schedule a job to send out an email if found there is a records older than 1 minute (compare to current date time against createddate) and the email will contain the itemid.
mytable design
1.) itemid int
createddate getdatetime()
summaryid varchar
startdate datetime
enddate datetime
this is what i have done
SELECT TOP 1*,DATEDIFF(mI, createdate, getdate()) AS ms
FROM mytable
Can anyone advised on this...
i was also thinking putting in the
set rowcount 1
if (SELECT DATEDIFF(mI, createdate, getdate())FROM prontoqueue) > 5
begin
Print 'more than 5'
end
else
Print 'less than 5'
setrowcount 0
i am hitting an error message...
Server: Msg 512, Level 16, State 1, Line 2
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
less than 5
please advised....thank you
|