• The RAISERROR with the NOWAIT clause is certainly a way to do it... and then, you have nothing but something printed on the screen. No way to do any real analysis... no way to really search for problem points over time.

    The best thing to do would be to build a log table and write to the log table instead of writing to the screen. Of course, you should capture the procname with little tricks like OBJECT_NAME(@@PROCID), etc, and maybe even make it so the row identity in the log is remembered so you can log the start and end time of each section of the code instead of having to do a self-join on the log table to find duration. The one I have at work is actually "multi-tiered"... shows start of job and end of job on a job header row. All other rows use that same job header ID to provide a common run (job) reference.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)