T-SQL Logic

  • Thanks for the question. At first glance it looked like it was going to be really difficult/complicated but ended up being simple and fun.

    ---------------------------------------------------------------------
    Use Full Links:
    KB Article from Microsoft on how to ask a question on a Forum

  • OCTom (6/22/2010)


    And the point is?... lost on me... again.:w00t:

    Yes, it was relatively simple to analyze, but some of the QOD's should be at an elementary level. Not all members of this community are seasoned DBAs or developers.

    As a note, I often try, as I did this time, to predict an answer from the copy of the question in the email newsletter, before seeing the multiple choices. That approach does crank up a few extra brain cells.

    Henrico, thanks for submitting this one. I'm taking a reminder here that sometimes it's best to break down a problem first and see if a simple component (ID < 2) will give the answer without having to delve into the complicated other parts. It's like those math riddles which have all sorts of strange stuff and end up with the anwer being zero: ((ln 23 / (19^16))*((2^3)-(64^0.5))

  • I chose option 4 because I didn't know that there were no negative DB ID's. It would not be unlike MS to use negative ID's for system objects.

    Now I know.

  • Interesting question, but I don't know that I would expect everyone to have the system DB IDs memorized. (Or even to know that DBs have IDs.) But given some basic understanding of the ID information the answer was very easy to pick out.

  • Thanks for the Question.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Huh... I thought I chose "1" but it says I answered the question wrong... what's up with that?

  • Interesting one. The explanation given isn't quite correct:

    2. len(case name when 'master' then 'other' else 'name' end) > 4 --only the length of 'master' > 4, all other db's are changed to 'name', which length =4.

    its not the len of the word 'master' being compaired, but the lenth of the word 'other'.


    Wayne

    Did you get access denied? Great the security works.

  • Take out "and database_id < 2"; you still get the same result and looks like a harder question.

    Ken

Viewing 8 posts - 16 through 22 (of 22 total)

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