MS SQL-Server - How to select numeric rows from a varchar column
Luckily T-SQL has an ISNUMERIC(value) function:
select ISNUMERIC('PostalCode123') -- Returns 0
select ISNUMERIC('123') -- Returns 1
Therefore:
select *
from Customer
where ISNUMERIC(PostalCode) = 1
...returns only the rows where the varchar column PostalCode is numeric.
Published: 16.01.2009
blog comments powered by Disqus

