Tuesday, February 13, 2007

[sql] Find all numerics out of varchar column

Problem:
I have a varchar column that contain a mix of alpha and numeric values. I need to find all rows where the column contain only numeric characters.

Solution (either one works):
select * from myTable where myCol not like '%[a-z]%';
select * from myTable where isnumeric(myCol)=1;

Source:
http://www.dbforums.com/showthread.php?t=1103852

No comments:

Post a Comment