January 16, 2012 at 8:25 pm
michael.kaufmann (1/5/2012)
Stuart Davies (1/4/2012)
Dave62 (1/4/2012)
Here's another beauty.
Select ISNUMERIC('£,,1.,') As "String";
Still returns a 1 :crazy:
Based on Jeff Moden's SQL Spackle on ISNUMERIC[/url], any of these characters evaluates to 1; so I'd assume that even a combination of "valid ISNUMERIC characters" results as 1.
Adding a single non-ISNUMERIC character to the string will return 0 as result:
select ISNUMERIC('£,,1.,a') col1;
It was a couple of real life examples like this (when importing a csv) that gave me the idea for this QOTD
Glad I'm usually working in a German context--the field delimiter in a .CSV or .TXT file has to be a semicolon (;) which will evaluate to 0. One of the rare occassions where it's actually a benefit... ;-):cool:
-Michael
My personal favorite for ISNUMERIC...
SELECT ISNUMERIC(0x20), CAST(0x20 AS INT)
Fairly useless, but still a favorite. 😀
--Jeff Moden
Change is inevitable... Change for the better is not.
January 16, 2012 at 8:42 pm
michael.kaufmann (1/4/2012)
Stuart Davies (1/4/2012)
Know what you mean Tom - but I took the wording straight from BOL (I know, a scarely used resource 🙂 ) to try and avoid any argumentsFor sake of completeness, here's also the link to BOL.
Anyway, Jeff's explanation in his SQL Spackle is definitely better and more entertaining :-)--so thanks to Jeff for his efforts and time and to Rich for sharing the link (and saving me the time to search for it myself).
Last but not least a great big thank you to Stuart for his QotD.
-Michael
The question and this whole thread has been a lot of fun. And thanks for the feedback on the article. I really do appreciate it.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 24, 2012 at 2:23 am
Nice and easy question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 12, 2012 at 1:41 pm
Where is the € Euro sign?
October 15, 2012 at 2:34 am
Viewing 5 posts - 31 through 34 (of 34 total)
You must be logged in to reply to this topic. Login to reply