• zerko (4/28/2013)


    the joys of answering early :pinch: -

    The QotD question states "Which of the following hints require the word WITH? (choose 3) "

    I don't use Table Hints that often, neither do I have a SQL Server 2012 installation to test, so I hit BOL and find the page on Table Hints http://msdn.microsoft.com/en-us/library/ms187373.aspx (Yes, same page the solution refers to). I read, and note the section under 'Arguments' that says 'The following table hints are allowed with and without the WITH keyword: ' - that indicates to me that the keyword is not required.

    With 5 options in the answer list, my logic says if 3 require the WITH keyword, then 2 will not. (Old school maths, didn't even use a calculator for that one) So I scan the list ... NOLOCK, there's one, ROWLOCK, that's the second one, others must be out. Tick, tick, tick, submit ... "Sorry - you were wrong." What the ...?!

    So I look at the BOL list again, and yes, there's XLOCK as well. So no matter which 3 I chose, I'd be wrong. There are only 2 that require the WITH keyword. The solution even says so too.

    Any chance this can be fixed before a whole lot more people get miffed about losing points for a flawed (but otherwise interesting) question?

    🙂 I still learnt a lot in the process.

    Personally I don't recall ever writing a granularity/isolation hint with WITH (and I have written some of those hints now and again and one, TABLOCKX, many times). However I do know that the "correct" syntax for them has WITH in it, while the correct syntax for join hints doesn't have it. So although I haven't yet got into the habit of including WITH in these hints (which I must do sometime soon) I thought the question was pretty straightforward, although the wording isn't perfect.

    Evidently you didn't look at the join hints page and the from page before reaching a conclusion. The other two hints listed as answer options don't come with WITH, it certainly isn't required for them as suggested by your "only 2" in bold. The three you've mentioned do have a deprecated concession that omitting WITH is allowed, so maybe the question would have better been worded using "are expected to have" rather than "require", but it's clear which 3 of these 5 hints should have WITH and which two shouldn't. Looking at the table hints page without looking at the other two relevant pages led you into the classical "a little knowledge is a dangerous thing" trap.

    Tom