How to find rows where a column contains a number

I needed to pull out all rows where a user id was numeric, SQL Server (as of 2005) has a  function IsNumeric:

SELECT USERID,USERNAME
FROM Users
Where IsNumeric(UserID) = 1

ISNUMERIC returns 1 when the input expression evaluates to a valid numeric data type; otherwise, it returns 0
MSDN

 

Related Posts

%d bloggers like this: