Solved

SP exceptional flow control

Posted on 2012-04-10
2
237 Views
Last Modified: 2012-04-12
Dear all DB expertist,

right now we have a system workflow monitoring tools called control-M, all our housekeeping job is running in a store procedure and we can see the the exeception flow control is not very good.

How can we improve the execeptional flow control the return as much information as possible when the SP failed to the monitoring system ? the Control-M.

All solution is welcome and I will try it one by one.

DBA100.
0
Comment
Question by:marrowyung
2 Comments
 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 250 total points
Comment Utility
I'm a big fan of TRY/CATCH blocks in newer versions of SQL Server. You can nest them if you want, and they provide excellent control over the flow of your T-SQL code when there's the possibility of an error.

Once you can control the flow sufficiently, you can use the RAISERROR keyword (note the mis-spelling - it's on purpose) to throw information of interest back to the control process that's calling the SP in the first place. Those details and the associated messages or codes can be logged and reported on at the application level.

Check out the link above for some examples of both RAISERROR and TRY/CATCH blocks to capture errors and report them.
0
 
LVL 42

Assisted Solution

by:EugeneZ
EugeneZ earned 250 total points
Comment Utility
please tell more about about this control-m and the execeptional flow control  that you have now:
check:

SQL Server 2008 error handling best practice
http://blogs.msdn.com/b/anthonybloesch/archive/2009/03/10/sql-server-error-handling-best-practice.aspx

http://www.sqlteam.com/article/handling-sql-server-errors
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now