• curious_sqldba (5/15/2013)


    i can try to get the schema.

    In the meanwhile is there a better way to write this piece:

    where Isnull(A.FPID, '') <> Isnull(V.FPID, '')

    The logic embodied in that form of condition is cumbersome no matter how you write it - managing NULLs in an ANSI SQL 92-compliant environment requires careful attention.

    Some thoughts on your query in general:

    1. An update with a single join of a table and view that generates the plan you posted indicates a very complex view!

    2. That many inequality conditions are very challenging to handle with any kind of efficiency since you basically can't index the table(s) in any way that's useful to the optimizer. You'll end up with table scan(s) all over the place.

    3. This looks like an effort to update the table where the data for the same entity differs between the table and the view. If what you want is for the table to look just like the view, why not just write the UPDATE statement without the conditions?

    Jason Wolfkill