• Thanks for providing that alternate implementation Celko.

    I can definitely see advantages of your approach, but I have a question: how would one remove extraneous records with your script?

    Say I work with a feline fanatic and she adds a cat to my Zoo. But my Zoo is very exclusive and only the most exotic animals should be allowed to stay inside. What I want is to eliminate any animal records that aren't included in my script, because my script represents the canonical source of my animal list (a sort of "Noah's Ark" to take the analogy one step further :-))

    In the OP MERGE statement, the "IF NOT MATCHED THEN DELETE" clause takes care of removing the extraneous rows.

    Given that a call to the "Zoo_Keeper" proc would be required for each record in your example, do you have any ideas how the DELETE might be achieved?