isnumeric

Efficient ISNUMERIC() replacements on SQL Server?

So I just spent 5 hours troubleshooting a problem which turned out to be due not only to the old unreliable ISNUMERIC but it looks like my problem only appears when the UDF in which ISNUMERIC is declared WITH SCHEMABINDING and is called within a stored proc (I've got a lot of work to do to distill it down into a test case, but my first n...

How do you test your Request.QueryString[] variables?

I frequently make use of Request.QueryString[] variables. In my Page_load I often do things like: int id = -1; if (Request.QueryString["id"] != null) { try { id = int.Parse(Request.QueryString["id"]); } catch { // deal with it ...

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 getting a type mismatch error, so I used IsNumeric() to check the string was numeric before try...

What is taking IsNumeric() so long in .NET?

Was doing some benchmarking with IsNumeric today and compared it to the following function: Private Function IsNumeric(ByVal str As String) As Boolean If String.IsNullOrEmpty(Str) Then Return False Dim c As Char For i As Integer = 0 To Str.Length - 1 c = Str(i) If Not Char.IsNumber(c) Then Return False N...

VBA Code to Count all Columns that are numeric in ListBox containing SQL Query Results

This is in Access 2007. I have tried writing somethig like: Forms!MyForm!TextBox = Count(ISNUMERIC(ISNUMERIC(QueryResult.Reading))) But this returns non-numeric results. I have also tried: Forms!MyForm!TextBox = IIF(ISNUMERIC(QueryResult.Reading),Count(ISNUMERIC(QueryResult.Reading),"") Anyone have any ideas? I am lost. ...

How do I use JavaScript for number formatting?

Hi, I want to use JavaScript to restrict input on a text box to currency number formatting. For example: <input type="text" value="2,500.00" name="rate" /> As given above, the text box should accept only numbers, commas and a period. But, after the period it should accept two digits after numbers. How do I accomplish this? Please ...

How to identify if string contain a number?

hi if I have this strings: "abc" = false "123" = true "ab2" = false Is there any command like IsNumeric or something else that can identify if string has numbers? thank's in advance ...

Any Reason Why IsNumeric() Fails On A Number?

I currently have this line of code which has been working for the past 6 months: If IsNumeric(txtProductID.Text) Then ...do stuff Else Dim msg As String = "Error!" End If All of the sudden, no matter what kind of entry is put in txtProductID (including plain numbers), it fails! Is there reason for me to be going crazy over this?...

intval or is_numeric? PHP

Hi, i am fetching a text from mysql database and i get it by ID in the url: site.php?id=1 and so on What is considered to be most safe to prevent sql injection and stuff. Is this way correct: <?php $news_id = $_GET['news_id']; if(!is_numeric($news_id)) die('Wrong'); //mysql_query and stuff here ?> OR this way: <?php $news_id = $_...

T-SQL IsNumeric() and Linq-to-SQL

I need to find the highest value from the database that satisfies a certain formatting convention. Specifically, I would like to fund the highest value that looks like EU999999 ('9' being any digit) select max(col) will return something like 'EUZ...' for instance that I want to exclude. The following query does the trick, but I can...

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) i get a row for <=50K. I am afraid my syntax is wrong, but not sure why. ALTER FUNCTION ...

PHP - usage of is_numeric() necessary, or can use comparison signs work for all positive numeric cases?

It seems that simple comparison signs >,>= and their reverse components can evaluate if a certain variable is a number or not. Example $whatami='beast'; ($whatami<0)?echo 'NaN':echo 'is numeric!'; Are there cases where is_numeric() usage is necessary for positive values (number >0)? It seems that using comparison signs above would deter...

Most elegant isNumeric() solution for java

I'm porting a small snippet of PHP code to java right now, and I was relying on the function is_numeric($x) to determine if $x is a number or not. There doesn't seem to be an equivalent function in java, and I'm not satisfied with the current solutions I've found so far. I'm leaning toward the regular expression solution found here: ht...

T-SQL Case statement utilizing substring and isnumeric

I have a T-SQL stored proc that supplies a good amount of data to a grid on a .NET page....so much so that I put choices at the top of the page for "0-9" and each letter in the alphabet so that when the user clicks the letter I want to filter my results based on results that begin with that first letter. Let's say we're using product na...

Question 1-Million ... ?

Congratulations everyone! We all love Stackoverflow! A huge personal thanks for a great site to Jeff and everyone involved :) ... I hope this question can be a landmark in the question time-line and a chance for people to put a stake in the ground marking classic and good questions for future and current users. Out of the 1-million...