Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 7th, 2003, 09:41 AM
JasonB JasonB is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Cape Town /-----\/\
Posts: 5 JasonB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Force job to fail using stored proc

I'm trying to do error trapping in SQL server and need to force the scheduled job to fail.
The scheduled job runs DTS packages and stored procs.

STEP 1
In the DTS package I'm setting a column in a table to a value to be used as a flag.
This is done at the end of the DTs package to indicate the processing is complete.
(I had a problem recently where the DTS package reported completing normally
but did not do any of the action in the package.)

STEP 2
I use the stored proc to evaluate the value of the flag (column in the table)
If this indicates that the DTS contents did not execute then the stored needs
to send a return or error code to the job to force it to fail so that any subsequent steps are not run.

I know that I can use RETURN to send back a return code, but from what i understand
the scheduled job doesn't check this RETURN code value.
Can I manually set @@ERROR to a value?

How do I force fail the job?

J.

Reply With Quote
  #2  
Old November 17th, 2003, 07:18 AM
JasonB JasonB is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Cape Town /-----\/\
Posts: 5 JasonB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

This for anyone else viewing this.

I basically wanted to do workflow in the scheduled job. I've since been advised to run all the steps (Stored procs, batch files, DTS packages) inside one DTS package and use the workflow inside the DTS pkg to control errors.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Force job to fail using stored proc


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT