• Eugene Elutin (8/30/2012)


    Search for "OMG" In J.M. article:

    http://www.sqlservercentral.com/articles/T-SQL/68467/

    It does explain the problem in details and gives good example.

    Ah yes, the bible on this subject. It appears Jeff has revised it since the last time I read it. New rules including the part about the 2 part update. So I'll need to brush up.

    For now though, it seems to have worked for SJ but s/he should probably take a look at the article also and at least add the TABLOCK hint if this is being done in something other than a temp table (refer to the OMG and Rules section) and it is not just a one off requirement.

    Thanks for letting me know about this Eugene!


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St