August 2, 2012 at 7:12 am
Nice question!
August 2, 2012 at 7:13 am
bitbucket-25253 (8/2/2012)
I am rather surprised at the low percentage of correct answers.Correct answers: 37% (76)Incorrect answers: 63% (129)
Total attempts: 205
And the implications this could have to those designing a DB, and inadvertently or deliberately using different definitions for a date time object in different tables (based only on each individual table's requirements) and then, when selecting, wondering why Select statements using a join / case / where on a date column do not return the correct data.
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.
August 2, 2012 at 7:43 am
patrickmcginnis59 (8/2/2012)
bitbucket-25253 (8/2/2012)
I am rather surprised at the low percentage of correct answers.Correct answers: 37% (76)Incorrect answers: 63% (129)
Total attempts: 205
And the implications this could have to those designing a DB, and inadvertently or deliberately using different definitions for a date time object in different tables (based only on each individual table's requirements) and then, when selecting, wondering why Select statements using a join / case / where on a date column do not return the correct data.
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.
But, but, but... the points you're missing out on... 😛
August 2, 2012 at 7:58 am
A most excellent question for content AND presentation.
+1
Cheers,
Steve
August 2, 2012 at 7:59 am
patrickmcginnis59 (8/2/2012)
bitbucket-25253 (8/2/2012)
I am rather surprised at the low percentage of correct answers.Correct answers: 37% (76)Incorrect answers: 63% (129)
Total attempts: 205
And the implications this could have to those designing a DB, and inadvertently or deliberately using different definitions for a date time object in different tables (based only on each individual table's requirements) and then, when selecting, wondering why Select statements using a join / case / where on a date column do not return the correct data.
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.
+1
Patrick, you are not the only one answering the QOTD this way. I also missed this one today.
Thanks for the question Bitbucket, and the reinforcement of the nuances of DateTime comparison.
-------------
Brian Smith
August 2, 2012 at 8:38 am
Nice question. I can definitely see a potential for issues like this when you have multiple developers working on the same database.
August 2, 2012 at 8:54 am
I didn't know about the selectable precision in datetime2, but once I read up about it, it became fairly clear what the answer should be--the only thing I was unsure about was if the value would get truncated or rounded up; I guessed the right way, fortunately!
August 2, 2012 at 9:23 am
Great question!
Rob Schripsema
Propack, Inc.
August 2, 2012 at 9:35 am
mtassin (8/2/2012)
Thanks for making me think... I had to sit there and keep reminding myself how the datetime2 values would round and then tried to keep two mental counts (statement 1 and statement 2) in my head as I did the rounding...🙂 glad I got it right, and glad I didn't have to use more than the fingers on one hand for each count 🙂
Definitely would have saved time to run the code, but I too did it this way. Good thing it was later in the day than usual, and I was on my nth coffee. Thanks bitbucket!
[font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
Connect to me on LinkedIn
August 2, 2012 at 10:12 am
paul.knibbs (8/2/2012)
I didn't know about the selectable precision in datetime2, but once I read up about it, it became fairly clear what the answer should be--the only thing I was unsure about was if the value would get truncated or rounded up; I guessed the right way, fortunately!
+1
Good question, I have not yet had the occasion to use the Datetime2 data type.
August 2, 2012 at 10:18 am
patrickmcginnis59 (8/2/2012)
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.
In that case I hope you are really good at working out what test cases to use!
Tom
August 2, 2012 at 10:23 am
Nice, very nice question. Thanks, Ron!
August 2, 2012 at 10:25 am
L' Eomot Inversé (8/2/2012)
patrickmcginnis59 (8/2/2012)
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.In that case I hope you are really good at working out what test cases to use!
As opposed to what? Not testing?
August 2, 2012 at 11:02 am
patrickmcginnis59 (8/2/2012)
L' Eomot Inversé (8/2/2012)
patrickmcginnis59 (8/2/2012)
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.In that case I hope you are really good at working out what test cases to use!
As opposed to what? Not testing?
Not as opposed to anything.
But if you are using code "in a project", it's very unlikely that you can rely on testing as opposed to working out what's happening, to get it right. Of course it would be pretty stupid to try to get by without testing (indeed pretty thorough testing) , but relying on testing to absolve you from writng code based on the requirements and understanding why that code might fit the requirements doesn't seem to me to be a sensible or useful approach.
Testing, design verification, understanding what some code does, and other things like using formal methods (eg Z) to verify correctness are not opposed to each other; they are all needed. What surprised me was the idea that just testing (as opposed to trying to understand before testing) was the right approach in a project.
Tom
August 2, 2012 at 4:26 pm
L' Eomot Inversé (8/2/2012)
patrickmcginnis59 (8/2/2012)
L' Eomot Inversé (8/2/2012)
patrickmcginnis59 (8/2/2012)
Speaking for myself, I'm relatively untroubled by missing questions like this. I always answer them based on what I know at the moment of answering, without testing in SSMS or googling. On the other hand, if I were using similar code in a project, I would actually test and research the situation. I doubt I'm the only one answering like that.In that case I hope you are really good at working out what test cases to use!
As opposed to what? Not testing?
Not as opposed to anything.
But if you are using code "in a project", it's very unlikely that you can rely on testing as opposed to working out what's happening, to get it right. Of course it would be pretty stupid to try to get by without testing (indeed pretty thorough testing) , but relying on testing to absolve you from writng code based on the requirements and understanding why that code might fit the requirements doesn't seem to me to be a sensible or useful approach.
Testing, design verification, understanding what some code does, and other things like using formal methods (eg Z) to verify correctness are not opposed to each other; they are all needed. What surprised me was the idea that just testing (as opposed to trying to understand before testing) was the right approach in a project.
Patrick
I think I probably misinterpreted both your original post and your response to my reply to that. Looking at it when not hurried makes it look quite different. I don't think you were advocating testing without trying to understand what was happening, and I apology for suggesting that you might be.
Tom
Viewing 15 posts - 16 through 30 (of 40 total)
You must be logged in to reply to this topic. Login to reply