July 20, 2011 at 5:31 am
Carlo Romagnano (7/20/2011)
I would replace the question "How many rows returned by executing all of the following?" in "How many rows returned by the last SELECT?" and add another answer: "None, because of no SELECT in the batch".
I didn't go that way because that would have been too obvious. I wanted a discussion starter, not a free point that nobody needs or cares about!
July 20, 2011 at 5:33 am
Mr Quillz (7/20/2011)
Hi Guys,I agree with most comments on this question, asking us how many rows would bereturned should not have been the way to put it. As we know the answer one would get is "(5 row(s) affected)" because of the extra UNION ALL.
Also there's a huge difference between 0 Rows being returned and there being no Rows selected. In this instance the answer of 0 rows returned also becomes incorrect.
Regards,
Quilz 😎
I said returned, not selected those are NOT synonyms). There's no dataset being returned so 0 is the correct answer.
July 20, 2011 at 5:35 am
BenWard (7/20/2011)
Well, I think this was a useful reminder to us to actually look at the code. Yeah you might have missed a point and there's an 'incorrect' answer against your name but if you read it properly before you answer you'll get it right. I don't think this was designed to trip us up so much as to test our debugging skills, when the OP was working on his issue he would have been thinking "What's wrong with my case filter?" so why not pose that question to us? It's real-world.If we can't so much as read a simple question properly on a simple 1-pointer, how are we expected to fully comprehend a business' requirements when we are developing some code from a functional spec etc.
From my PoV the QotD is there, not as a status symbol or as bragging points but rather to help us do our jobs better. Sometimes that means showing us things we didnt already know, sometimes asking really complicated questions and other times simply to keep us on our toes so we don't get complacent in our day to day job. As the OP states, this came from a cut and paste error - we all get those from time to time and this is a good reminder to take a step back and really look at our code when we get unintented behaviour that we can't get our heads around.
Wise man! Saw my intention exactly for what it was even before I could post the explainations in the Thread!
July 20, 2011 at 5:36 am
Toreador (7/20/2011)
BenWard (7/20/2011)
don't forget, if this question - or it's answer - was actually wrong it wouldn't have been published.Sadly that's not the case. There have been many recent questions with minor typos, how were we to know that this wasn't another?
Agreed, but not this one. Steve and I gave this a good 2 weeks of thoughts to give the best possible experience to the members.
July 20, 2011 at 5:38 am
BenWard (7/20/2011)
Toreador (7/20/2011)
BenWard (7/20/2011)
don't forget, if this question - or it's answer - was actually wrong it wouldn't have been published.Sadly that's not the case. There have been many recent questions with minor typos, how were we to know that this wasn't another?
oh well I thought they were read over by the good people who run this place first.
It would appear that people are trying to overcomplicate the question:
"0 seems like a silly answer therefore I will assume the OP meant something entirely different from what he actually asked and answer accordingly... What? My answer was wrong? Don't be silly the questin was wrong!"
🙂
In management studio a query often outputs to 2 tabs, Messages and Results.
If anything is RETURNED by a query it goes in Results.
If anything is PRINTED by a query it goes to Messages.
'(5 rows affected)' comes up in Messages and there is no 'Results' tab. There is no results tab because there were no results, logically, 0 rows have been returned by the query batch.
Yes Steves reads the questions and tries his best to make sure they are correct. But contrary to popular beliefs, he still makes mistakes once in a while and doesn't know everything about sql server. ;-):hehe:
July 20, 2011 at 5:40 am
cengland0 (7/20/2011)
BenWard (7/20/2011)
From my PoV the QotD is there, not as a status symbol or as bragging points but rather to help us do our jobs better.Sorry but this one will not help me do my job better. It only serves to give me anxiety and provokes an emotion of rage.
Then stick around, hopefully the best part of the QOTD is yet to come!
BTW I can lend you some points of mine if that can dissipate some of that anxiety :w00t: :Whistling:
July 20, 2011 at 5:40 am
Ignacio A. Salom Rangel (7/20/2011)
Great question! I got it wrong, but I still like it.
Glad you liked it, nice tell us about the last time you had an id-10-t moment like this one ;-).
July 20, 2011 at 5:41 am
I recognized the extra UNION ALL but didn't realize it was a trick question. I missed it because 5 rows are affected, just not returned. I'll read the question/answers better next time.
http://brittcluff.blogspot.com/
July 20, 2011 at 5:48 am
Carlton Leach (7/20/2011)
I saw the extra Union/gotcha in this Qotd...but...Qotd (as far as I understand it) is generally about teaching (at least some of us) something that we weren't aware of, not sure that this one does that. Apart from attention to detail I guess...
Carlton.
Thanks for reminding me. I also wanted to re-link to this article. It basically reminds us that working too much is actually harming our productivity. Over 2 months, 60 hours / week will give the exact same output as 40 hours / week. Think about it, over 2 months, you wasted 1 for NOTHING.
July 20, 2011 at 5:51 am
Richard Warr (7/20/2011)
Excellent question. I got it wrong (even after runnign the code) but there's a lesson there for all of us for whom getting things right depends on how we interpret a somewhat unclear specification.
Well, I'd have thought you should seek clarification rather than try to interpret something that is unclear.
July 20, 2011 at 5:51 am
I missed it fair and square. I totally missed the extra UNION ALL.
As to the spirit of the question, I have conflicting thoughts. I appreciate Ninja's_RGR'us's attempt to get us to look for the basics, as there is a tenancy to overcomplicate bug hunts. The devil is in the details - usually punctuation, etc.
While I hope we don't have a lot of questions like this one, thanks for your efforts.
[font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
Connect to me on LinkedIn
July 20, 2011 at 6:08 am
Thomas Abraham (7/20/2011)
I missed it fair and square. I totally missed the extra UNION ALL.As to the spirit of the question, I have conflicting thoughts. I appreciate Ninja's_RGR'us's attempt to get us to look for the basics, as there is a tenancy to overcomplicate bug hunts. The devil is in the details - usually punctuation, etc.
While I hope we don't have a lot of questions like this one, thanks for your efforts.
You're welcomed. So when's the last time you faced a similar issue like I did?
July 20, 2011 at 6:09 am
Ninja's_RGR'us (7/20/2011)
Agreed, but not this one. Steve and I gave this a good 2 weeks of thoughts to give the best possible experience to the members.
I think my problem is not with this question, but with the previous ones with the trivial mistakes in, which led me to assume that was the case here as well.
July 20, 2011 at 6:17 am
Toreador (7/20/2011)
Ninja's_RGR'us (7/20/2011)
Agreed, but not this one. Steve and I gave this a good 2 weeks of thoughts to give the best possible experience to the members.
I think my problem is not with this question, but with the previous ones with the trivial mistakes in, which led me to assume that was the case here as well.
That's fair. Let's put something out there, I won't put level 100, 200 nor 300 questions out there. It's either going to be level 400 stuff or real life scenario with (ideally) immediate benefits to the members.
Between Steve and I, let's hope that we won't make any silly mistakes.
July 20, 2011 at 6:19 am
Ninja's_RGR'us (7/20/2011)
You're welcomed. So when's the last time you faced a similar issue like I did?
I make mistakes all the time. People that type like I do seldom go into computing! (That's one reason I spent years in data modeling - less typing! 😉 )
Most of my mistakes get caught by SMS. Sadly, while I'm sure there's a good one that happened in the not too distant past, I'm not able to recall any particular similar incident. Blame it on old age.
[font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
Connect to me on LinkedIn
Viewing 15 posts - 31 through 45 (of 200 total)
You must be logged in to reply to this topic. Login to reply