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
1
vote
2 answers

VB.Net Code comparision - which one is better and why?

it's my first post. Could you give me some tips which code is better and why? Mainly those two codes do the same, but using other methods. Cheers FIRST CODE Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Age.Click Dim age…
WuWy
  • 11
  • 1
1
vote
1 answer

Excel Formula substitute similar values into a single formula

I have set up this formula, For each cell it should subtract the contents from what i have stored in data!$B$1, in this case this is 300, so if the contents of "Time 1" is 100, this will display 200, this will then add up all of these values from…
TomRGarr
  • 63
  • 8
1
vote
2 answers

Using IsNumeric in a function

I wrote a function that generates a "score" (1,0,-1) based on a input cell, which should contain a number. However, sometimes the input field might not be numeric and then the function should return the output "0". Function ScoreRoE(RoE_Field As…
yannk
  • 51
  • 6
1
vote
2 answers

Detect numeric year from string using Swift

I am looking for a way to detect years e.g. 2019. The requirements I think would be that the numbers are in a row, have four digits and are not adjacent to letters or special characters. So I'd like to get the method to return "2019" in each of the…
user6631314
  • 1,751
  • 1
  • 13
  • 44
1
vote
2 answers

How can I skip non-numeric values when copy and paste using loop in VBA?

I would like to copy and paste a formula from column P to column C using a loop in VBA. The code should only copy and paste for numeric values in column P and do nothing when cell is blank. Sub TestAll() For i = 10 To…
Robert
  • 49
  • 2
  • 8
1
vote
3 answers

Taking sum of all lines containing number and skipping those with alphabets and write back the sum to another file

I have written the following code which reads a file that contains lines with numbers and alphabets I want to calculate sum of all numbers in a single line and skip the lines with alphabets and finally write back that sum to another file. File to be…
1
vote
3 answers

Using IsNumeric to delete rows of data

I have two columns of data I am cleaning up using VBA. If the value in column A is non-numeric or blank, I need to delete the entire row. Below is a sample of the data and the code I am trying to use. It seems to be completely skipping over the…
Koda
  • 165
  • 5
  • 13
1
vote
1 answer

What are all values ISNUMERIC function finds as TRUE in sql server?

Below part of my query was failing initially: WHEN ISNUMERIC(npx.nvcAnswer) = 1 THEN CASE WHEN ABS(CONVERT(DECIMAL(38,2),npx.nvcAnswer)) < 1 THEN CONVERT(VARCHAR,CONVERT(DECIMAL(38,2),npx.nvcAnswer)) …
1
vote
2 answers

Delete contents from cell, IFIsNumeric = False

So I have this program; that scans values from a remote system. At times it can timeout if network is down and it will put in #nan error or something similar. When I try and write that error message to a database; it errors out for a "Data Type…
1
vote
1 answer

Sybase check if value is numeric

How can I check if the value is numeric? I tried is numeric but it is returning an error that the function is not found. Example: select *isnumeric*("abc") // returns 0 or false select *isnumeric*("123") // returns 1 or true
Ray
  • 627
  • 1
  • 7
  • 19
1
vote
1 answer

Performance: is_numeric() and is_string() in a foreach loop

I have a bunch of arrays in an array ex. $array = array( array(/../), array(/../), array(/../), //upto 100-200 arrays ); After that, I will use foreach to echo all of them. There is…
Dumb Question
  • 365
  • 1
  • 3
  • 14
1
vote
0 answers

VBScript accepts "2.50+" and "2.50-" as valid numeric types?

I have a condition in my code similar to: If not IsNumeric(x) Then ... End If when x = "2.50+ or x = "2.50- or any other valid number with '+' or '-' tacked on to the end, IsNumeric(x) returns True! So both examples of x are valid numeric types for…
Dane Lowrey
  • 170
  • 1
  • 10
1
vote
2 answers

SQL CASE isNumeric with multiple values?

I have an instance where sometimes we aren't sure to filter by the name text or the name id. I've solved this with a case statement and isnumeric. For example, we have both the id and name values but we're not sure which column is being asked to…
triplethreat77
  • 1,276
  • 8
  • 34
  • 69
1
vote
4 answers

Need help with syntax for test ISNUMERIC in case

I am trying to stop input of negative values to process in any of the ranges, rather if they are negative they should drop down to the end of the 1st case statement as 'Invalid'. This is not working as when I run a test against the input of (-1000)…
JMS49
  • 263
  • 1
  • 8
  • 18
1
vote
1 answer

Fix IsNumeric Loop Bug?

I am trying to fix a simple loop so that the message box won't go away until the user enters an integer. Here is my code: Sub PlateMicro() strName = InputBox(Prompt:="Enter number of wells in plate. The default is 96 (8X12).", _ …
user4974730