Numbers

  • 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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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 arguments

    For 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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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

  • Where is the € Euro sign?

  • Try

    SELECT ASCII('€');

Viewing 5 posts - 31 through 34 (of 34 total)

You must be logged in to reply to this topic. Login to reply