October 31, 2016 at 11:12 pm
Comments posted to this topic are about the item Case Statement Update
----------------------------------------------------
October 31, 2016 at 11:13 pm
This was removed by the editor as SPAM
November 1, 2016 at 1:36 am
Very good question. I got it wrong, because I couldn't (apparently) read this early in the morning 🙂
But a very good example of where inexperienced developers tend to get things wrong with CASE.
Sql Server blog: http://www.tsql.nu
November 1, 2016 at 2:26 am
Glad to see my brain is still working, even after waiting 2 hours for my flight, with another 4 to go! I was pretty sure it had given up when it saw the delays board >_<
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 1, 2016 at 3:35 am
Depends which column you're looking at, could be 1 and 3, or one of the options you listed 😀
Ignore me - have contracted the plague overnight so my head isn't really working hehe - good question, never really had to use the syntax so learnt something new 🙂
November 1, 2016 at 4:54 am
Good one, which I'd have got correct if I'd remembered to read the title of the question!
November 1, 2016 at 5:38 am
I had to read it twice because I was looking for the trick. Nice, straightforward question. Thanks.
November 1, 2016 at 6:45 am
Good question - and apparently not all that easy since 45% of us got it wrong.
Thanks.
November 1, 2016 at 6:46 am
Good question, thanks.
November 1, 2016 at 10:31 am
Interesting - thank you!
November 1, 2016 at 12:30 pm
Ed Wagner (11/1/2016)
I had to read it twice because I was looking for the trick. Nice, straightforward question. Thanks.
Thanks Ed. No tricks, though it is the day after Halloween :-). Simply highlighting a situation one might encounter in the normal SQL world.
----------------------------------------------------
November 8, 2016 at 1:08 am
Somehow completely missed that the data type was bit.
Moar caffeine needed!
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 8, 2016 at 11:25 am
Koen Verbeeck (11/8/2016)
Somehow completely missed that the data type was bit.Moar caffeine needed!
Ok maybe the defaulting of the bit field to 'false' is a little "bit" tricky. Part of the whole question is showing that this is possible and to look out for these things 🙂
----------------------------------------------------
November 10, 2016 at 5:10 pm
MMartin1 (11/8/2016)
Koen Verbeeck (11/8/2016)
Somehow completely missed that the data type was bit.Moar caffeine needed!
Ok maybe the defaulting of the bit field to 'false' is a little "bit" tricky. Part of the whole question is showing that this is possible and to look out for these things 🙂
No, that wasn't tricky really, as defaults only take effect when an insert or update doesn't specify the content of the column, and here the content is specified because the case statement provides content for that column in every row affected by the update, so the only question is what content does the case statement provide for the columns of interest.
Unless, of course, someone imagines that a default constraint substitutes the default value for a specified NULL, which is about on a par with failing Jeff's favourite interview question.
Tom
November 12, 2016 at 6:04 pm
...Case Statement Update...
Shouldn't that say "case EXPRESSION update"?
...One of the symptoms of an approaching nervous breakdown is the belief that ones work is terribly important.... Bertrand Russell
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply