• As K Cline pointed out, put the update field comparison in the WHERE clause instead of the in a CASE statement in the UPDATE. This allows the optimizer to potentially lessen the # of rows it needs to update. The CASE statement method will not help performance.

    In regards to the cost values in your execution plan, optimizing a portion of a query will most times result in the costs being split out to other tasks. This is not always a bad thing. A query has to have 100% cost somewhere so just because one task is higher than some does not always mean it is not efficient. I like to base efficiency decisions more off of logical reads than the cost value in the query plan. Improving logical reads is a more accurate measure of how much a query has improved.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden