Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IsNumeric giving unexpected results

2 views
Skip to first unread message

Burton Roberts

unread,
Nov 10, 2003, 8:56:43 AM11/10/03
to
For instance:
IsNumeric('1000000,1000000') returns 1 instead of 0.
IsNumeric('100000,100000') returns 0, as I would expect.

Is there a rule here?
Burton Roberts


David Portas

unread,
Nov 10, 2003, 9:18:08 AM11/10/03
to
From BOL:

"ISNUMERIC returns 1 when the input expression evaluates to a valid integer,
floating point number, money or decimal type; otherwise it returns 0."

Your string can be cast as MONEY therefore ISNUMERIC returns 1.

If you want to test for a string containing only the digits 0-9 then use one
of the following expressions:

PATINDEX('%[^0-9]%',@numstr)=0

@numstr NOT LIKE '%[^0-9]%'

--
David Portas
------------
Please reply only to the newsgroup
--


Burton Roberts

unread,
Nov 10, 2003, 10:21:45 AM11/10/03
to
Thanks, David

"David Portas" <REMOVE_BEFORE_R...@acm.org> wrote in message
news:VMmdndKbdsg...@giganews.com...

Louis Davidson

unread,
Nov 10, 2003, 11:22:02 AM11/10/03
to
Why does :

select cast('1000000,1000000' as money)

Work where:

select cast('100000,100000' as money)

Doesn't?
--
----------------------------------------------------------------------------
-----------
Louis Davidson (dr...@hotmail.com)
Compass Technology Management

Pro SQL Server 2000 Database Design
http://www.apress.com/book/bookDisplay.html?bID=266

Note: Please reply to the newsgroups only unless you are
interested in consulting services. All other replies will be ignored :)

"David Portas" <REMOVE_BEFORE_R...@acm.org> wrote in message
news:VMmdndKbdsg...@giganews.com...

Steve Kass

unread,
Nov 10, 2003, 5:16:07 PM11/10/03
to
Because there must be 0, 1, 2, 3, or 7 digits preceding the
leftmost comma of a string in order for the string to be
convertible to money, assuming no overflow or other invalid
characters. An optional decimal point is allowed among the
digits preceding the first comma, which must not be
separated from the comma by more than 4 of the digits.

This and other similar restrictions do not seem to be
documented, unfortunately. ;)

SK

Louis Davidson

unread,
Nov 13, 2003, 1:09:35 AM11/13/03
to
Is this in books online? I have never heard this. Thanks for the
information.

--
----------------------------------------------------------------------------
-----------
Louis Davidson (dr...@hotmail.com)
Compass Technology Management

Pro SQL Server 2000 Database Design
http://www.apress.com/book/bookDisplay.html?bID=266

Note: Please reply to the newsgroups only unless you are
interested in consulting services. All other replies will be ignored :)

"Steve Kass" <sk...@drew.edu> wrote in message
news:3FB00E2...@drew.edu...

0 new messages