Questions tagged [isnumeric]

Determines whether an expression is a valid numeric type.

Syntax

ISNUMERIC ( expression )

Remarks

ISNUMERIC returns 1 when the input expression evaluates to a valid numeric data type; otherwise it returns 0. Valid numeric data types include the following:

enter image description here

Example

USE AdventureWorks2012;
GO
SELECT City, PostalCode
FROM Person.Address 
WHERE ISNUMERIC(PostalCode)<> 1;
GO

Note

For, SQL Server 2012+ use TRY_PARSE instead as ISNUMERIC is treating as numbers some not numeric values:

SELECT ISNUMERIC('123') as '123'
      ,ISNUMERIC('abc') as 'abc'
      ,ISNUMERIC('-') as '-'
      ,ISNUMERIC('+') as '+'
      ,ISNUMERIC('$') as '$'
      ,ISNUMERIC('.') as '.'
      ,ISNUMERIC(',') as ','
      ,ISNUMERIC('\') as '\'

enter image description here


Helpful links

191 questions
7
votes
5 answers

PHP "is_numeric" accepts "E" as a number

I noticed PHP is_numeric() accepts "E" as a number. I have a string: "88205052E00" and I want the result to be: NOT numeric. Here is the code which I tested.
Cyborg
  • 1,437
  • 19
  • 40
7
votes
3 answers

How to check isNumeric / isNumber in JSTL?

How to do this simple check in JSTL (without extending any Java classes and additional JSP functions). I need it like this: // do something Thanks in advance.
Stefan Michev
  • 4,795
  • 3
  • 35
  • 30
6
votes
3 answers

PostgreSQL 9.3: isnumeric() in a condition

I need to check whether the given text is numeric or not from the function. Creating function for isnumeric(): CREATE OR REPLACE FUNCTION isnumeric(text) RETURNS BOOLEAN AS $$ DECLARE x NUMERIC; BEGIN x = $1::NUMERIC; RETURN TRUE; EXCEPTION…
MAK
  • 6,824
  • 25
  • 74
  • 131
5
votes
2 answers

How to use IsNumeric method in MonoDevelop by using Microsoft.VisualBasic reference?

What I am trying to do is to check whether the float input is a number or not. I am being asked to do so by using IsNumeric() method. The problem is that I am using MonoDevelop and I can't figure out why this doesn't work. It seems like I have added…
HelpNeeder
  • 6,383
  • 24
  • 91
  • 155
5
votes
10 answers

VB6 Can IsNumeric be wrong?

Is it possible to test a string with IsNumeric() and for it to return true, but when you cast that same string to an integer using CInt() and assign it to a variable of type integer that it will give a type mismatch error? I ask because I was…
Matt
5
votes
1 answer

Excel check if value is number inside COUNTIFS

I'm trying to count the number of cells in a row that contain "valid" values. There are many criteria for the value to be valid. So far I have this: COUNTIFS(INDEX(S2ScoresAssQ1,ROW()-4,0),"<>",S2UnitSelectorQ1,"<>2",S2CodeAssQ1,O$2) but cells that…
user3925803
  • 3,115
  • 2
  • 16
  • 25
5
votes
3 answers

VBA IsNumeric going WILD

Please explain why the below code behaves randomly The below line of code returns TRUE when it should have return FALSE ?Isnumeric("555-") Also ?Isnumeric("555-"/2) returns TRUE Please explain this random behavior of IsNumeric?
Rohit Saluja
  • 1,517
  • 2
  • 17
  • 25
5
votes
6 answers

Checking for numeric value entered in text box in Visual Basic

I am working on a program for my Visual Basic class and have a quick question. One of the things we were encouraged to do was to check to make sure the quantity entered in a text box is actually a number. Our professor suggested using IsNumeric to…
user2932587
5
votes
5 answers

How to test if string is numeric using Progress 4GL

Does Progress 4GL have a function for testing whether a string is numeric, like PHP's is_numeric($foo) function? I've seen the function example at http://knowledgebase.progress.com/articles/Article/P148549 to test if a character in a string is…
Donna
  • 149
  • 1
  • 3
  • 7
5
votes
2 answers

HQL function to extract rows with field contains only number

I've have a little issue to expose: I want to extract from an entity, suppose its name "CustomerDetail" all rows where a specific field (code) has only numeric characters. In HQL doesn't exist ISNUMERIC() function like Sql Server, and the…
Joe Taras
  • 15,166
  • 7
  • 42
  • 55
5
votes
3 answers

IsNumeric function returning true for an empty cell

I run a macro that copies tables from a PDF file and saves them on Excel. some of the tables contain empty cells and in my analysis I need to know the number of cells that are empty. I have a function that iterates through each column to check if…
user2681358
  • 99
  • 1
  • 1
  • 8
5
votes
7 answers

Difficulty checking if elements in array are type integer PHP

I am trying to detect if one or more variables contain numbers. I have tried a few different methods, but I have not been entirely successful. Here is what I have tried.
Daniel Mabinko
  • 1,351
  • 3
  • 11
  • 10
4
votes
3 answers

Is there an isAlpha function in VB.NET

I have a variable to hold an id Dim empId as String So the format for a valid ID is: 'the first character should be a letter [A-Z] 'the rest of the string are digits e.g M2895 would be a valid id I would like to check each of those characters to…
Redgren Grumbholdt
  • 1,115
  • 1
  • 19
  • 36
4
votes
5 answers

T-Sql ISNUMERIC('45D-1') returns 1

I have a T-Sql statement that is getting the next available number from a table. but the column is of type nvarchar. It dost have to be a number, But i still need to be able to get the next available number so when i run the sql i try to only get…
CMS
  • 3,657
  • 1
  • 27
  • 46
3
votes
2 answers

IsNumeric in SQL Server JOIN

My problem seems to be very simple but I'm stuck here. I have a table which has an "nvarchar" column called "SrcID" and I store both numbers and strings in that. Now, when I try to check for "IsNumeric" on that column in a "Join" condition,…
Praveen
  • 1,449
  • 16
  • 25
1
2
3
12 13