BIT data type

  • Good question but this real doesn't have to do with the data type bit but instead about reading double negatives

    IF NOT EXISTS (SELECT 1 WHERE @BIT IS NOT NULL) SELECT 'Output 2'

    @Bit could have been any non-null type

  • mbova407 (1/22/2013)


    Good question but this real doesn't have to do with the data type bit but instead about reading double negatives

    IF NOT EXISTS (SELECT 1 WHERE @BIT IS NOT NULL) SELECT 'Output 2'

    @Bit could have been any non-null type

    I have to agree... it was nice to get my brain started this morning though.... it's too cold in Chicago... I was having a hard time getting my thinking cap on because I don't want to take the wool one off.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Nice, easy logic question to get the day started!

  • Thanks for the question (and the point)

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • The question's IF statements challenged my logic processing more than the data type, but it still was a good question because I like logic puzzles - Thanks 🙂

  • Excellent question. I speculate that Output 2 drew the most wrong answers due to its double-negative ("not exists ... is not null").

  • Thank you for the question.

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • Nice, +1

    Not all gray hairs are Dinosaurs!

  • nice question..

    +1 😛

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Nice question, but the reference provided in the explanation doesn't cover the only interesting point here, which is whether the variable is null after assigning the string 'TRUE' to it; Lokesh Vij already posted the reference for that.

    Of course the question could be answered with very little idea of what's going on, since either the variable was null (in which case there would be three outputs) or it wasn't (and there would be no output). Since thoption for three outputs wasn't avalaible, the right answer had to be no output - so just the ability to evaluate simple boolean expressions would be enough to answer the question. So it's rather surprising that 218 people (21%) managed to get it wrong.

    Tom

  • Nice, easy question.

  • It's nice a question.

  • Nice brain tease figuring out the NOT EXISTS WHERE IS NOT NULL 🙂

    But this is more of a general parameter null question, not just limited to the bit data type, correct?

  • Easy One +1

  • easy even without running code

Viewing 15 posts - 16 through 29 (of 29 total)

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