October 15, 2013 at 7:09 am
Thanks, interesting question...
October 15, 2013 at 7:44 am
if "101" had been an option I'd have chosen it (and been wrong)
I would not have expected isnumeric('$') to be 0
October 15, 2013 at 7:50 am
easy question..
there is an excellent explanation from Jeff moden..
October 15, 2013 at 8:08 am
pchirags (10/15/2013)
easy question..there is an excellent explanation from Jeff moden..
+1 I was thinking about the same article pchirags. 😀 I've ran into a few issues like this with IsNumeric and have done my homework on it so this was an easy one. Great question.
October 15, 2013 at 8:08 am
pchirags (10/15/2013)
easy question..there is an excellent explanation from Jeff moden..
Yes. That SQL Spackle is excellent as is the ensuing dicussion. Thanks for bringing it to our attention.
October 15, 2013 at 2:28 pm
Dhruvesh Shah (10/14/2013)
Good question. Any one know why it returns 1 for some/most of special characters?
ISNUMERIC returns 1 if the input can be converted to a numeric data type. It doesn't bother to tell you which data type.
In the case of '-', most data types will do (It is interpreted as -0). Similar for '.', which is interpreted as 0.0.
The '$' symbol converts to only a specific numeric data type: money (and smallmoney). It is interpreted as $0.00.
SELECT CAST('$' AS money);
October 15, 2013 at 2:29 pm
Nice question, thanks! 🙂
October 15, 2013 at 2:36 pm
Hugo Kornelis (10/15/2013)
ISNUMERIC returns 1 if the input can be converted to a numeric data type. It doesn't bother to tell you which data type.
I've yet to discover what numeric type a non-breaking space (ASCII 160) can be converted to, though honestly I haven't put much work into it as the answer would be useless to me anyway. An ISNUMERIC(value,type) function would be far more useful.
ron
-----
a haiku...
NULL is not zero
NULL is not an empty string
NULL is the unknown
October 15, 2013 at 2:54 pm
ronmoses (10/15/2013)
Hugo Kornelis (10/15/2013)
ISNUMERIC returns 1 if the input can be converted to a numeric data type. It doesn't bother to tell you which data type.I've yet to discover what numeric type a non-breaking space (ASCII 160) can be converted to, though honestly I haven't put much work into it as the answer would be useless to me anyway. An ISNUMERIC(value,type) function would be far more useful.
ron
As others have said, TRY_CONVERT in SQL Server 2012 fills that gap.
October 15, 2013 at 2:56 pm
Hugo Kornelis (10/15/2013)
As others have said, TRY_CONVERT in SQL Server 2012 fills that gap.
Ah yes, I must have glossed over it due to the "2012" part. I try not to get excited about toys I can't have. 😀
ron
-----
a haiku...
NULL is not zero
NULL is not an empty string
NULL is the unknown
October 15, 2013 at 3:27 pm
Really simple one, back to basics... thanks, Kanu!
October 15, 2013 at 9:17 pm
Nice and easy Q, thanks
Hope this helps...
Ford Fairlane
Rock and Roll Detective
October 16, 2013 at 3:48 am
ronmoses (10/15/2013)
I've yet to discover what numeric type a non-breaking space can be converted to
Most of them I'd have thought, on the basis that in some locales a space is used as the thousands separator.
October 17, 2013 at 9:39 am
Had forgotten about this so it was a great reminder. Thanks
Not all gray hairs are Dinosaurs!
Viewing 15 posts - 16 through 30 (of 33 total)
You must be logged in to reply to this topic. Login to reply