Friday, June 04, 2004

SQL Server 2000's IsNumeric LIES!

Quoth the Books Online:

Remarks
ISNUMERIC returns 1 when the input expression evaluates to a valid integer, floating point number, money or decimal type; otherwise it returns 0. A return value of 1 guarantees that expression can be converted to one of these numeric types.

[ emphasis mine ]


Now try this in Query Analyzer:

Select IsNumeric('.')

...which returns 1. So, for bonus points, what does this do?

Select Cast('.' As Numeric)

...an error. Wonderful. Lies, lies, lies. This function could be in the Bush administration!

1 Comments:

At 2:59 AM, Blogger asaperson said...

As the good book(s online) says:

ISNUMERIC returns 1 when the input expression evaluates to a valid integer, floating point number, money or decimal type; otherwise it returns 0. A return value of 1 guarantees that expression can be converted to one of these numeric types.

And now try:
Select Cast('.' As money)

Typical dutch unfounded complaining ;)

 

Post a Comment

<< Home