ISNUMERIC

  • happycat59 (3/5/2013)


    Mmm, why have "ISNUMERIC" as the heading for this question ? This question is not really about the ISNUMERIC function. How about getting the heading to match what the question is really about instead of deliberately trying to mislead ?

    Because that would point you directly to the answer. I would have called it "You figure it out."

    I only got it right because I assumed it was yet another example of how much ISNUMERIC() sucks.

    ron

    -----
    a haiku...

    NULL is not zero
    NULL is not an empty string
    NULL is the unknown

  • Thanks for the question

    Always define the length of your VARCHARS people 😀

  • L' Eomot Inversé (3/6/2013)


    Nice question, but I don't much like the heading. Fortunately I've learnt not to pay much attention to QotD headings.

    Yeah, I understand everyone's complaint about the header, but if it was accurate then that would sort of give away the answer.

  • ...

    Because that would point you directly to the answer. I would have called it "You figure it out."

    ...

    I like that. All questions going forward should have the title "You figure it out"

  • Ooooooh, you almost got me, but I caught it at the last second before pulling the trigger. :-D. Thanks for the question.



    Everything is awesome!

  • lots of people have issues with Header of the QOD 😎

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Lokesh Vij (3/5/2013)


    +1 🙂

    Well this question is about ISNUMERIC and VARCHAR both. I realized the VARCHAR gotcha and marked the correct answer.

    Same... but I can also see the point... the subject isn't really about what ISNUMERIC will test or won't... it's about what happens when you don't give varchar a length..



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Very good question!

    Though I make a habit of specifying the n in a varchar declaration, I had no idea that in a DECLARE, without a specified n, it would default to 1. I also picked up the tidbit from another poster that a cast/convert without n would default to 30. For me, since I work in SQL Server all day, this was very valuable.

    Thanks again!

  • Please try this:

    SET @vchrIsNumeric='$NAME',

    Is Numeric or Is not Numeric?

    --------------------------------------
    ;-)“Everything has beauty, but not everyone sees it.” ― Confucius

  • chgn01 (3/6/2013)


    Please try this:

    SET @vchrIsNumeric='$NAME',

    Is Numeric or Is not Numeric?

    That will return Is Numeric as well. Same thing if you do '£NAME'. I think any currency character will evaluate as numeric. I tried it with the symbols for the US cent, Yen, US dollar and British pound.

  • Thank you Fire Drill!

    --------------------------------------
    ;-)“Everything has beauty, but not everyone sees it.” ― Confucius

  • Agree with the title of the QOD being missleading, and to make sure people do NOT conclude, incorrectly, how ISNUMERIC works may I suggest that every one read this excellent SQL SPACKLE article by Jeff Moden

    http://qa.sqlservercentral.com/articles/IsNumeric/71512/

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Slightly misleading, yes... But thanks anyway, Ramana!

  • Hugo Kornelis (3/6/2013) I also think that this adds a nice touch of realism. If a junior on my team made this mistake and came to me after not being able to figure it out, they would probably also tell me that they have a problem with ISNUMERIC.

    I actually like the title, for the same reason given by Hugo. A person could beat his/her head against the wall, not noticing that the declare statement did not specify a length. This is what debugging is all about.

  • bitbucket-25253 (3/6/2013)


    Agree with the title of the QOD being missleading, and to make sure people do NOT conclude, incorrectly, how ISNUMERIC works may I suggest that every one read this excellent SQL SPACKLE article by Jeff Moden

    http://qa.sqlservercentral.com/articles/IsNumeric/71512/

    Thanks for the link. I was wondering what other characters might fall into the IsNumeric trap. I prefer the regex approach myself.

    Ken

Viewing 15 posts - 16 through 30 (of 42 total)

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