I'm sure this is a common question (but I can't find an answer anywhere else...)
We've inherited a column that is "varchar" that is actually populated with integers in MOST of the rows. However, some rows have letters and some are NULL and some are blank.
SELECT h.Account_ID, p.Amount
FROM Account_History h, Payment p
WHERE h.Account_ID = 3000679 AND
CAST(h.GeneralText AS int) = p.Payment_ID
The above SQL statement works great up to row 315 where it encounters: h.GeneralText = "AC33456"
I want to just skip this row (return p.Amount = NULL or zero) and continue on.
How do I convert the text that is "convertable" to integers and just skip the others without bombing the SQL statement?