How do you set a SQL Server job step status?

20 pts.
Tags:
SQL Jobs
SQL Server 2005
SQL Server 2005 SP3
SQL Server database
I am running SQL Server 2005. I have a job that has six steps to load a database table from an external source. The external source is required to send the file nightly. In system testing I found this is not always the case. I created a batch 'step' (Step 3) to check if the file has been sent (see code below). If the file is present I use today’s file. If the file is not present I use last night's file (demographic data). I cannot set Step 3 ‘Job Step Properties – Advance tab’ to ‘on failure action’ because logically it will not fail. I want to modify the code to ‘move’ last nights’ file and then indicate the step has failed (force failure – set the job step status property?). Then I would execute the next step (Step 4) that notifies the external source of not receiving the file. I only want to execute Step 4 when I do not receive the file. How do I set the job step status property in Step 3 to indicate 'failure' after moving the file? Does anyone have any solutions? STEP 3 code @echo off Retailer file transfer. if exist "E:SQL DatabasesSQL JobsSQL Import DataGPRetailer.del" goto done echo NO RETAILER FILE TO TRANSFER! :begin move "E:SQL DatabasesSQL JobsSQL Import DataGPRetailer.old" "E:SQL DatabasesSQL JobsSQL Import DataGPRetailer.del" echo Moved! :done echo Done!

Software/Hardware used:
Microsoft SQL Server 2005 SP3

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Subhendu Sen
    Hope this Guide helps u !
    27,510 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following