Friday, January 16, 2009

MS SQL-Server - How to select numeric rows from a varchar column


select ISNUMERIC('PostalCode123') -- Returns 0
select ISNUMERIC('123') -- Returns 1

Therefore:


select *
from Customer
where ISNUMERIC(PostalCode) = 1