I keep receiving an error when execute a query:
The datediff function resulted in an overflow. The number of dateparts separating two date/time instances is too large. Try to use datediff with a less precise datepart.
The query has worked for some time (years to be exact):
SELECTDISTINCT
A.OPENDATEASOPEN_DATE,
A.CLOSEDDATEASCLOSED_DATE,
CASEWHENISNULL(A.CLOSEDDATE,'1776-07-04') ='1776-07-04'ORDATEDIFF(MI,OPENDATE, A.CLOSEDDATE)< 0 THEN NULL
WHENDATEDIFF(MI,OPENDATE, A.CLOSEDDATE)BETWEEN 0 AND 1440THEN'Y'
ELSE'N'
ENDAS24HR_flg,
FROM
tableA
LEFTJOIN
tableCON A.ID =C.ID
WHERE
C.PROCESS_FLAG= 1
What’s the maximum value you can have when getting the datediff in minutes? Let’s assume I HAVE to use minutes in the query