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.
is pronounced ree-bar and is a Modenism for R
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs