Open In App

ISNUMERIC() Function in SQL Server

ISNUMERIC() function: This function in SQL Server is used to check if the stated expression is numeric or not. 

Features:



Syntax :

ISNUMERIC(expression)

Parameter: This method accepts only one parameter as given below :



Return Type: It returns 1 if the specified value is numeric form else it returns 0. 

Example-1: Using ISNUMERIC() function and getting the output.

SELECT ISNUMERIC(1352);

Output :

1

Here, 1 is returned as the stated value is numeric. 

Example-2: Using ISNUMERIC() function and getting the output.

SELECT ISNUMERIC('abd');

Output :

0

Here, 0 is returned as output as the stated expression is not numeric. 

Example-3: Using ISNUMERIC() function and getting the output using a variable.

DECLARE @exp INT;
SET @exp = 44;
SELECT ISNUMERIC(@exp);

Output :

1

Example-4: Using ISNUMERIC() function and getting the output using multiplication operation and a variable as well.

DECLARE @exp INT;
SET @exp = 30*7;
SELECT ISNUMERIC(@exp);

Output :

1

Application: This function is used to test if the stated expression is numeric or not.

Article Tags :
SQL