I am using sql 2016 (SP1), I have a join between two tables:
FROM table1 t1
JOIN table2 t2
ON t1.varchar(50) = t2.decimal(18,0)
Sometimes it fails with:
Error converting data type varchar to numeric.
In the past, someone corrected the source data and the script stoped failing, but now source data won’t be corrected.
What can I add to prevent it from failing? I do not mind losing that one row that can’t be converted.
I use
WHERE TRY_CONVERT(numeric, varchar(50)) IS NOT NULL
But it still fails.