Errors
Value cannot be cast to date
Cannot cast [x] to [x]
Invalid format
Cause
Your query contains an invalid cast operation, meaning the value in that column can't be converted to the selected data type.
Solution
The error message itself will indicate the incompatible value and operation. In the example below, our operation failed because a text string cannot be converted to an integer.
You will need to review your source table or data for these inconsistencies. When doing this, it may be helpful to temporarily remove the cast operation from your query and see if any other errors occur.