I am getting this error on one of the SQL jobs.
declare @month int=null
select from Table_A where CAST(CONVERT(datetime, TableLocalDate, 131) AS DATE) <=DATEADD(MONTH,@Month-1, GETDATE())
"The conversion of a varchar data type to a date time data type resulted in an out-of-range value"
The TableLocalDate is of varchar data type
Could you please advise how this query can be fixed?