• Rob Fisk (1/30/2011)


    So for an update statement I may write this initially

    SELECT m.*

    --UPDATE m SET monkey = 'marmosette'

    FROM monkeys m

    WHERE MonkyID=2

    Just make sure you write it like that. I have seen colleagues write like this:

    UPDATE m SET monkey = 'marmosette'

    SELECT m.*

    FROM monkeys m

    WHERE MonkyID=2

    They would select the last three lines and execute the selection then delete the select and execute the update. Unfortunately, if you forget to delete the select you end up with two statements executing.

    SQL guy and Houston Magician