If you have a long running SP, do you log somehow its actions or just wait for this message?
“Command(s) completed successfully.”
I assume, that there can be plenty solutions on this subject, but is there any best practice – a simple solution that is frequently used?
EDIT
I’ve found an interesting link on this subject
http://weblogs.sqlteam.com/brettk/archive/2006/09/21/12391.aspx
Article describes using a log table, but there’s an issue
The logging procedure must be executed outside of any transaction
I can’t call that insert outside, because of cursor that I use and insert a line to that table on every row.
Any ideas?
EDIT 2
Digging..
there’s a xp_logevent in SQL Server. Did you try it?
What about SQL Server Profiler?
There’s also Creating Log file for Stored Procedure
How are you invoking the stored procedure? If it is through Management Studio then you can easily print out the message as follows
This is preferable to using
PRINTas the message will appear immediately. These messages can also be caught in ADO.NET by wiring up a handler for the Connection.InfoMessage event.I see that you have already listed SQL Profiler as a possibility. You might be interested to know that you can log your own user configurable events that can be seen in SQL Profiler.