Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Error Tracking Get to the root issue immediately!

Similar presentations


Presentation on theme: "Advanced Error Tracking Get to the root issue immediately!"— Presentation transcript:

1 Advanced Error Tracking Get to the root issue immediately!
MATT MARTIN SQL Saturday Atlanta | 2016

2 About 8 years working with SQL Server and SSIS
Senior Manager at Fortune 50 Company Responsible for centralizing and building out data warehouse for .COM business Built financial forecasting and budgeting models for really big data sets MD Data Technologies Chief Technology Officer Website:

3 Agenda Common Error Tracking Options Another Creative Solution
Identify bottlenecks in procs Where things went wrong Building an error and logging notification system to give you immediate feedback on SQL errors DEMO

4 Common Error Tracking Options
Job Agent msdb.dbo.sysjobhistory table trigger Third Party Software Manual highlighting of lines of code and running one-by-one NOOOOOOOOO!!!!! A well formatted error tracking with user feedback messages as they occur in the procedure Another Creative Solution

5 Identify bottlenecks in procs
Most developers use a PRINT statement after each line of code. What’s wrong with PRINT? No immediate feedback. Don’t show up to the client until the proc finishes or SQL flushes the buffer

6 Identify bottlenecks in procs
There is a way though to get REAL-TIME feedback! Answer: RAISERROR What? I don’t want to raise errors on my server! RAISERROR can be used to send back real-time messages to the client without having SQL Server throw an actual error by specifying a zero severity. RAISERROR('DATASET ISOLATED TO TEMP TABLE',0,1) WITH NOWAIT

7 How do we identify the bottleneck?
The key is the “NOWAIT” part. This instructs SQL Server to output the message immediately. RAISERROR('DATASET ISOLATED TO TEMP TABLE',0,1) WITH NOWAIT This allows for real-time feedback and the developer does not have to wait until the end of the proc to see output statements.

8 Where things went wrong
Utilizing a wrapper proc that integrates with Database Mail will generate a well formatted and professional message.

9 Where things went wrong
Place your existing proc in a try/catch CREATE PROC usp_my_proc AS SET NOCOUNT ON; BEGIN TRY EXEC usp_feedback 'attempt to divide by zero' SELECT 1/0 END TRY BEGIN CATCH varchar(250) = db_name() EXEC 'my custom message' END CATCH Just call usp_etl_err_log and the will go

10 Now the Fun Stuff! DEMO Building an advanced error notification system


Download ppt "Advanced Error Tracking Get to the root issue immediately!"

Similar presentations


Ads by Google