SQL Server ISNUMERIC() Function: Check Numbers
SQL Server ISNUMERIC()
function determines whether the given expression is a valid numeric type.
ISNUMERIC(input_expression)
Parameters
input_expression: A value or an expression to be checked as number or not.
Return Value
Returns an integer type. ISNUMERIC returns 1 if the input expression is a valid numeric expression, else it returns 0.
SQL Server valid numeric data types include int, smallint, bigint, tinyint, bit, decimal, numeric, float, real, money, smallmoney.
Note: the ISNUMERIC()
returns 1 for some non-numeric characters like a plus (+), minus (-), and some currency symbols like a dollar sign ($).
Example 1:
The following ISNUMERIC()
function checks if the passed value is of number type or not. It returns 1 if it is a number.
SELECT ISNUMERIC(1234) AS Result;
The ISNUMERIC()
returns 0 if the passed value is non-numeric.
SELECT ISNUMERIC ('Hello') AS Result;
You can also use the ISNUMERIC()
function with a currency value like a dollar sign ($). It considers it as numeric and returns 1.
SELECT ISNUMERIC ($25) AS Result;
It considers the negative number as numric value.
SELECT ISNUMERIC(-4) AS Result;