March 6, 2013 at 5:29 am
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
March 6, 2013 at 5:52 am
Thanks for the question
Always define the length of your VARCHARS people 😀
March 6, 2013 at 5:54 am
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.
March 6, 2013 at 5:56 am
...
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"
March 6, 2013 at 7:23 am
Ooooooh, you almost got me, but I caught it at the last second before pulling the trigger. :-D. Thanks for the question.
March 6, 2013 at 7:24 am
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/
March 6, 2013 at 8:12 am
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..
March 6, 2013 at 8:19 am
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!
March 6, 2013 at 8:43 am
Please try this:
SET @vchrIsNumeric='$NAME',
Is Numeric or Is not Numeric?
--------------------------------------
;-)“Everything has beauty, but not everyone sees it.” ― Confucius
March 6, 2013 at 9:24 am
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.
March 6, 2013 at 9:32 am
Thank you Fire Drill!
--------------------------------------
;-)“Everything has beauty, but not everyone sees it.” ― Confucius
March 6, 2013 at 9:45 am
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
March 6, 2013 at 10:13 am
Slightly misleading, yes... But thanks anyway, Ramana!
March 6, 2013 at 10:14 am
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.
March 6, 2013 at 12:14 pm
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
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