• I think that the first version should be a simple (as per Einstein's definition) set based query that resolves the business question. Of course, this assumes that it is a suitable piece of functionality for this approach. After that you have the basis to perform optimisations as appropriate. It is then worth commenting why optimisations were applied as the optimisations for one SQL Server release may not apply to another etc.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!