Doris Manning
mikedorism at verizon.net
Wed Oct 7 17:41:44 CDT 2009
If you check @@Error after each step of the process, you can do it all within the SP itself. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Wednesday, October 07, 2009 11:19 AM To: Dba-Sqlserver Subject: [dba-SQLServer] Error logging I have reached the point where I need to start logging processes (SQL Statements) and any errors encountered in my stored procedures. I typically run stored procedures where I will create a field in a table, create an index to facilitate updating that field, update the field, then drop the index. There can be many processes in that stored procedure, 4 or 5 or more. I want to log after each step. My concept is to build a ProcessLog table where I log the process itself. This table would hold things like ProcName, ProcMemo, ProcDate, ErrInt, ErrStr. It seems logical to create a stored procedure to call after each process completes or in the Catch statement in order to log errors. This stored procedure would accept parameters and actually write to the log table. The process steps usually take a long time, often minutes or even tens of minutes, thus the time to log each one is not an issue. I assume that many of you do something similar so I am asking for guidance or advice for how you handle this. -- John W. Colby www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com