• kll (1/20/2010)


    Good to see examples of the output clause.

    The @@identity problem should be a no-problem, if people just remembered to use scope_identity() instead. It will return the correct identity value to you. No identities from triggers.

    .

    If you're using the output clause then you don't need to use either of those. I'd still use scope_identity for single row inserts though

    Just remember that using any kind of @@identity or scope_identity() will still require some RBAR on multi line inserts.

    Surely the whole point of this article is that you don't need to do any RBAR. I use this technique a lot. Best result was on a stored proc that inserted typically about 500 top level records, each consisting of several sub-hierarchies ranging from one to 4 levels deep. Execution time went down from about 20 minutes to a few seconds.