| Return To Topics |
Originally Posted: 6/12/2006 5:23:50 PM |
| |
Last Updated: 6/12/2006 5:23:50 PM |
Subject:
Finding Only Numeric Values In A Column
You Asked....
I am looking for a way to find rows that have only numeric value in a column called TotalDollarAmt.
For example:
123 should return true
abc should return false
456 should return true
$123.456 should return false.
When using the ISNUMERIC function $123.456 still return true because SQL Server casts the value to a number.
Any ideas?
and we responded....
My first thought would be to use the ISNUMERIC function just like you did.
However, like you said $123.456 will be implicity converted to a number.
What we need to do is use a wild card search combined with pattern matching.
Something like this will work
SELECT columnName FROM tableName WHERE columnName LIKE LIKE '%[0-9]%'
|