Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Decimal Field Value Fails VBSCRIPT "ISNUMERIC"

Author  Topic 

Mr Fett
Starting Member

28 Posts

Posted - 2009-07-23 : 12:42:01
Hi all,

I'm hitting a strange issue where data taken from an SQL Server 'decimal' fieldtype (precision 16, scale 6) is returning FALSE in to a vbscript "ISNUMERIC" test.

I'm not doing any kind of conversion, etc with the value - literally taking it from a recordset and dumping it straight in to a query:

RESPONSE.WRITE(ISNUMERIC(myRS("myDecmicalNumber")))

Result:
FALSE

I've checked and the numbers retrieved are normal decimals such as 345.32.

A forum here suggests turning off the SQL Mail feature due to a potential region conflict but I don't have it enabled: http://www.developmentnow.com/g/113_2006_1_0_0_678032/IsNumeric-decimal-value-returns-false-NOT-the-dot-issue.htm

Thanks in advance for any help!

Bob

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-27 : 12:54:29
I understand it is strange to have the function return False. But, why do you even need to check if you know the data type is Decimal already?
Go to Top of Page

Mr Fett
Starting Member

28 Posts

Posted - 2009-07-27 : 13:07:33
quote:
Originally posted by Lamprey

I understand it is strange to have the function return False. But, why do you even need to check if you know the data type is Decimal already?



I was using it to determine whether or not their was a value in the record, I'm now using ISNULL instead but I consider it good practice if I'm doing a comparison to use the most restrictive comparison even if I know the source.

Of course the most important thing from a programmer's point of view is I just NEED TO KNOW why its not working
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-07-27 : 14:15:17
It's been years since I've done anything like that in VBScript.. Do you need to get the Value first? I was wondering if it considers myRS("myDecmicalNumber") as an object..?

Go to Top of Page

Mr Fett
Starting Member

28 Posts

Posted - 2009-07-27 : 14:22:22
quote:
Originally posted by Lamprey

It's been years since I've done anything like that in VBScript.. Do you need to get the Value first? I was wondering if it considers myRS("myDecmicalNumber") as an object..?





Hi Lamprey,

No - that returns the value. All other comparisons work fine, its just ISNUMERIC against DECIMAL. I've seen this issue before (years ago) and it only affects the DECIMAL datatype, INT, BIG INT, MONEY, etc are all fine. I need to upgrade to SQL Server 2005 :-)
Go to Top of Page
   

- Advertisement -