ISNUMERIC

ISNUMERIC is a built-in function in SQL Server that verifies whether an expression can be converted to a numeric value. It returns 1 if the expression can be converted to a number, and 0 if it cannot.

ISNUMERIC( expression )

  • expression: A valid SQL Server expression that is able to return a single unit of data like a string. This specific parameter becomes the target for the ISNUMERIC function to evaluate whether it can be converted to a numeric data type or not.

Example

DECLARE @TestValue VARCHAR(10) = '12345';
SELECT ISNUMERIC(@TestValue) AS Is_Numeric;

Output

Is_Numeric
----------
1

Explanation

ISNUMERIC returns 1 when the input can be converted to one of the numeric data types. In this example, it tests whether the value ‘12345’ is numeric, and returns 1, indicating that it is numeric.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.