I have a varchar column that has generally has a decimal value, but some times there is some garbage text characters in that field.
Is it possible to filter in the WHERE clause for rows that sucessfully convert to a decimal value?
I am using sql-server 2005
One way is the ISNUMERIC function:
There’s one gotcha:
isnumericreturns 1 whenever a string can be converted to any numeric type, includingmoney. For example, say you have rows using varying decimal separators, like7.9and7,9. Both will convert tomoney, andisnumericreturns 1 for both of them. But only one converts todecimal, depending on the SQL Server language settings.