John
John

Reputation: 1

Arithmetic overflow on date field

I have a simple query:

SELECT COUNT(*)
FROM table1
JOIN table2 ON (table1.fiscal = table2.fiscal)

Both "fiscal" fields are of type "DATE". This produces the error:

Arithmetic overflow error converting expression to data type int.

This specific error on a date field is new to me. Typically I've seen this related to bad data in a VARCHAR field that is being treated as an INT.

I have attempted to use ISDATE() to identify that I have valid dates, but this is an invalid function for DATE columns.

Upvotes: 0

Views: 47

Answers (1)

Sushil Behera
Sushil Behera

Reputation: 971

I believe you have too many results which is insufficient to store in int data type.

Please try.

SELECT COUNT_BIG(*)
FROM table1
JOIN table2 ON (table1.fiscal = table2.fiscal)

Upvotes: 1

Related Questions