March 5, 2013 at 8:26 pm
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 ?
This question is about the default length used for the VARCHAR data type. I am expecting a variation on this question to pop up soon where the answer is VARCHAR (30).
March 5, 2013 at 9:21 pm
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 ?This question is about the default length used for the VARCHAR data type. I am expecting a variation on this question to pop up soon where the answer is VARCHAR (30).
+1 π
Well this question is about ISNUMERIC and VARCHAR both. I realized the VARCHAR gotcha and marked the correct answer.
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
March 5, 2013 at 9:29 pm
Lokesh Vij (3/5/2013)
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 ?This question is about the default length used for the VARCHAR data type. I am expecting a variation on this question to pop up soon where the answer is VARCHAR (30).
+1 π
Well this question is about ISNUMERIC and VARCHAR both. I realized the VARCHAR gotcha and marked the correct answer.
well, in a way it is true .. varchar does store only "3"; the first character ..
and ISNumeric does evaluate the string "3" as numeric .. I look at heading to get extra information , but, here straightforward question ..
nice and simple ...
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
March 5, 2013 at 10:29 pm
demonfox (3/5/2013)
Lokesh Vij (3/5/2013)
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 ?This question is about the default length used for the VARCHAR data type. I am expecting a variation on this question to pop up soon where the answer is VARCHAR (30).
+1 π
Well this question is about ISNUMERIC and VARCHAR both. I realized the VARCHAR gotcha and marked the correct answer.
well, in a way it is true .. varchar does store only "3"; the first character ..
and ISNumeric does evaluate the string "3" as numeric .. I look at heading to get extra information , but, here straightforward question ..
nice and simple ...
+1
Good start of day. π
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
March 5, 2013 at 10:40 pm
good basic question to start the day....
In first line I saw that its only varchar to length would be 1 only and 3 is present in text so quickly mark the answer as IS Numeric π
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 6, 2013 at 12:05 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 ?
a litle modification in the question and a missing reference .. and it would go for the header π
DECLARE @vchrIsNumeric CHAR(2)
SET @vchrIsNumeric='3 NAME'
IF ISNUMERIC(@vchrIsNumeric)=1
SELECT 'Is Numeric'
ELSE
SELECT 'Is not Numeric'
output would be the same ..(might put a dot for a second :-P)
and here is the missing reference on IS_Numeric :
http://msdn.microsoft.com/en-gb/library/ms186272.aspx
Edit :
This question is about the default length used for the VARCHAR data type. I am expecting a variation on this question to pop up soon where the answer is VARCHAR (30).
yes.. It might :hehe:
as mentioned in msdn :
When n is not specified in a data definition or variable declaration statement, the default length is 1. When n is not specified when using the CAST and CONVERT functions, the default length is 30.
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
March 6, 2013 at 12:22 am
well....i did it again......
knowing the declaration without the size will default to 1 and at the time of cast/convert it defaults to 30.... and... me being dumbest of all the time i mentally switched the answers and considered 30 as the default to the variable with no size... thinking "is not numeric" is a straight and sweet deal...
...
..
.
(one second later) after clicking the submit the button
.
.
#facepalm
(sorry) good question by the way; thank you for posting, remembrance of the defaults is another key point in the level of basic. thank you.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
March 6, 2013 at 2:20 am
I read the question very carelessly. I didn't notice that variable declared without specifying length.
--
Dineshbabu
Desire to learn new things..
March 6, 2013 at 2:21 am
Don't really pay attention to the heading as it can often be misleading and just focus entirely on the detail of the question.
I like these "gotcha" bug style questions, little reminders of what's waiting in SQL to catch the unwary LOL!
Good nice question with a quick answer. Great job.
Thanks π
_____________________________________________________________________
[font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]
March 6, 2013 at 3:18 am
haha. this not really about IsNumeric(). these type of questions are fun to solve. π
--------------------------------------------------------------------------------------
Hai Ton
My Db4Breakfast blog.
March 6, 2013 at 3:39 am
Nice question to check the attentiveness
as well as to expalin the default behaviour of Varchar data type π
March 6, 2013 at 4:43 am
This was removed by the editor as SPAM
March 6, 2013 at 4:53 am
Nice question, but I don't much like the heading. Fortunately I've learnt not to pay much attention to QotD headings.
Tom
March 6, 2013 at 5:13 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.
I never look at the headings either, so this didn't bother me.
And while I understand the objections raised, 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 beiing able to figure it out, they would probably also tell me that they have a problem with ISNUMERIC.
Viewing 15 posts - 1 through 15 (of 42 total)
You must be logged in to reply to this topic. Login to reply