How can I search for numbers in a varchar column

Posted by dave on Stack Overflow See other posts from Stack Overflow or by dave
Published on 2010-04-20T06:22:22Z Indexed on 2010/04/20 6:33 UTC
Read the original article Hit count: 258

Filed under:
|
|

I've got a simple nvarchar(25) column in an SQL database table. Most of the time, this field should contain alphanumeric text. However, due to operator error, there are many instances where it contains only a number. Can I do a simple search in SQL to identify these cases? That is, determine which rows in the table contain only digits in this column. As an extension, could I also search for those column values which contain only digits and a space and/or slash.

In other languages (eg. Perl, Java) a regular expression would resolve this quickly and easily. But I haven't been able to find the equivalent in SQL.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server