Discussion:
null date in query
(too old to reply)
mcnewsxp
2013-03-26 18:46:55 UTC
Permalink
how code this correctly so I don't get this error: "Arithmetic overflow error converting expression to data type datetime." I know it's here: "GETDATE() - C1.Notice1Date" because notice1date will be null on some rows.

WHERE
(((GETDATE() - C1.IssueDateTime) > 7) AND (C1.Notice1Date IS NULL))
or
((C1.Notice1Date is not null)
and (((GETDATE() - C1.Notice1Date) > 7) AND (C1.Notice2Date IS NULL)))
mcnewsxp
2013-03-26 18:57:04 UTC
Permalink
Post by mcnewsxp
how code this correctly so I don't get this error: "Arithmetic overflow error converting expression to data type datetime." I know it's here: "GETDATE() - C1.Notice1Date" because notice1date will be null on some rows.
WHERE
(((GETDATE() - C1.IssueDateTime) > 7) AND (C1.Notice1Date IS NULL))
or
((C1.Notice1Date is not null)
and (((GETDATE() - C1.Notice1Date) > 7) AND (C1.Notice2Date IS NULL)))
I ended up using a union all query

Continue reading on narkive:
Loading...