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:
- This function is used to check if the given expression is numeric or not.
- This function returns 1 if the given expression is in numerical form.
- This function returns 0 if the given expression is not numeric.
- This function comes under Advanced Functions.
- This function accepts only one parameter namely expression.
Syntax :
ISNUMERIC(expression)
Parameter: This method accepts only one parameter as given below :
- expression: Specified expression or the value which is to be checked if its numeric or not.
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.
Contact Us