We help IT Professionals succeed at work.

SQL Package Active X Task (Stop Execution from within VBscript)

Rog D
Rog D asked
on
1,080 Views
Last Modified: 2013-11-30
I have a SQL 2000 DTS package.

In side the package I have an Active X Task (VBScript).

It looks to see if a file exists.  

If Yes   Main =  DTSTaskExecResult_Success
else
  ***** want to stop procedure but return success to scheduled job.

In ohter words I have a package the is scheduled to run every day.  Some days we don't receive a file, so I don't want an error or failure, just to stop the pacage from running and exit successfully.

Is this possible?

Thanks

Rog
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2010

Commented:
Main =  DTSTaskExecResult_Success
Dim fso, result
Set fso = CreateObject("Scripting.FileSystemObject")
result = fso.FileExists("path to file here")
Set fso = Nothing
If Not result Then Exit Sub

'put rest of code here
Rog DSQL Developer / Web Development / Business Analysis
CERTIFIED EXPERT

Author

Commented:
Matthew,

This is good and I do understandt this.  

The code you provided does check for a file, but then I want to exit DTS Package with success not just exit the task.

The reason for this is if a file is found I want to the dtspackage task with success and continue.

Rog
CERTIFIED EXPERT
Top Expert 2012
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Rog DSQL Developer / Web Development / Business Analysis
CERTIFIED EXPERT

Author

Commented:
I understand, What exactly does the  DTSStepScriptResult_DontExecuteTask
do.  

Will is stop the package from running?

Will is set the exit code to success?

The problem I have is I can set Main = "Success" or "Failure" based on finding a file.

Then take the workflow failure route, but then the job shows "Error"

Basically I want the job to end as a success if a file is NOT found.

If a file is found, I want the package to continue with success route executing other tasks or other items.

Thanks,

Rog
CERTIFIED EXPERT
Top Expert 2012

Commented:
>>What exactly does the  DTSStepScriptResult_DontExecuteTask<<
They are the constants used in Workflow ActiveX Scripts in much the same way that DTSTaskExecResult_Success and DTSTaskExecResult_Failure are used in the Task ActiveX Script

>>Will is stop the package from running?<<
Yes.

>>Will is set the exit code to success?<<
Yes.

>>The problem I have is I can set Main = "Success" or "Failure" based on finding a file.<<
I understand.  It will never work that way.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.