Solved

SP exceptional flow control

Posted on 2012-04-10
2
240 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
ID: 37830096
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
ID: 37830227
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Update Query - What's wrong with this. 18 20
Filtered index 5 56
Error in query 3 52
SQL Query Conversion of IIF statement into CASE - Syntax issue 17 33
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

17 Experts available now in Live!

Get 1:1 Help Now