• John Mitchell-245523 (2/8/2012)


    surely its down to the developer / administrator to realise that there is no guarantee what value will be used in the update.

    Precisely. Would you use that syntax if there were no guarantee what would happen when you did so?

    The non-deterministic behaviour of UPDATE..FROM is well known and fully documented in BOL.

    Fully documented - maybe, although a quick search just now didn't reveal anything. Well known - I'd dispute that. I think there are a lot of people who use it (myself included, up to a year ago) without understanding the implications.

    There are other non-deterministic functions in SQL Server such as the ANSI compliant ROW_NUMBER - would you ban that as well?

    I don't see how that's relevant to this discussion. We're talking about non-deterministic updates, not non-deterministic functions. In any case, I'm not saying anything should be banned. I'm just expressing the opinion that this particular syntax should not be used unless there are compelling reasons to do so (and I don't deny that such compelling reasons do exist).

    John

    Documented here

    http://msdn.microsoft.com/en-US/library/ms177523(v=sql.90).aspx

    In the section "Using UPDATE with the FROM Clause"

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537