It's quite clear ... whatever version of SQL you are using does not have a function called
curdate()
. If you are using SQL Server then try using
getdate()
.
You will probably then get a similar error on
DATE_SUB
- try
datediff[
^] instead.
The real message here is don't copy solutions online unless you are sure they are for the same language/framework/etc that you need.
[EDIT - response to OP comment to Solution 2]
Quote:
I have tried to resolve it using different function.. and tried researching.
for:
WHERE StartDate <= CONVERT(dateTime, DATEDIFF(minute, 5, GETDATE()))
I get error
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type datetime.
The
Datediff
function returns an integer - ie. the number of minutes (or seconds, or years etc etc) and cannot be converted to a
DateTime
. Use your StartDate and StartTime columns and the current datetime within the function e.g.
where DATEDIFF(minute, GETDATE(), StartDate + CONVERT(DateTime, StartTime)) > 5