CASE vagaries

  • Thanks Hugo, feeling much better after reading your post. Thought I had Monday morning madness.

  • I appreciate the effort of the OP to submit this question.

    However, I don't see how the OP could have thought that one of the answers given was correct, had they actually run the code.

    Hopefully we all learned something today, and the OP's next question will be better.

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • Look at it from the positive side - at least the official correct answer was still the "least incorrect" option.

    Yep, that's why I chose it. When in doubt choose the least incorrect answer.

  • sknox (9/9/2013)


    david.gwalter (9/8/2013)


    First time I have come across a question with an incorrect answer.

    A little disappointing for a novice like myself.

    I find that even for questions that are well and correctly written, the discussion holds additional information. So it's almost always worthwhile to read the discussion, even if the question is poorly written. I treat the questions as more of an introduction to a topic of the day.

    I also try to keep in mind that the questions are written by the community, and so will reflect the varying levels of knowledge and skill out there.

    Having said that, question authors should at least run the code they write and make sure that their answer is correct in that respect.

    +1

  • I suspect that the intention was to demonstrate that ISNULL will pick up the first datatype in the list which in this case is char(1). Therefore the value of returned from the isnull would only be the first character in the longer string. It is interesting that the title refers to CASE when what is seems the user is evaluating is the knowledge of how ISNULL works.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Actually the answer is: @X is now A<

  • I agree. None of the the answers, A, B, C, or D, are correct. Because the ISNULL uses the data type of @x (Char(1)). The correct answer is '@X is A<'

  • I keeped looking at this one tying to get one of the answers. Got lucky and just picked the closest one.

  • A poor question, and incorrect answers. My apologies. I know I ran the code, but I'm guessing I didn't examine the answers closely enough.

    I have updated the answers and awarded back points.

  • Steve Jones - SSC Editor (9/9/2013)


    I have updated the answers and awarded back points.

    I was just about to say, don't know what everyone is talking about, the correct answer is there, I even double checked it in SSMS! Thanks Steve.

  • Ross.M (9/9/2013)


    Steve Jones - SSC Editor (9/9/2013)


    I have updated the answers and awarded back points.

    I was just about to say, don't know what everyone is talking about, the correct answer is there, I even double checked it in SSMS! Thanks Steve.

    +1 Some times it pays to come late to the game.

    😀

    Not all gray hairs are Dinosaurs!

  • Miles Neale (9/9/2013)


    Ross.M (9/9/2013)


    Steve Jones - SSC Editor (9/9/2013)


    I have updated the answers and awarded back points.

    I was just about to say, don't know what everyone is talking about, the correct answer is there, I even double checked it in SSMS! Thanks Steve.

    +1 Some times it pays to come late to the game.

    😀

    +1

  • Steve Jones - SSC Editor (9/9/2013)


    A poor question, and incorrect answers. My apologies. I know I ran the code, but I'm guessing I didn't examine the answers closely enough.

    I have updated the answers and awarded back points.

    Glad to see it's right now.

    Tom

  • I am glad I got to answer this one after it was corrected. 😉

  • learn a new thing today don't know that is null work in that way

    Every rule in a world of bits and bytes, can be bend or eventually be broken
    MyBlog About Common dialog control
    A Visualizer for viewing SqlCommand object script [/url]

Viewing 15 posts - 16 through 30 (of 33 total)

You must be logged in to reply to this topic. Login to reply