Re: make a job successful
- From: "Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Sep 2007 08:15:27 -0500
BTW, I used the same logic as your original script but it seems to me to be reversed. I think it should be:
If oFSO.FileExists(sFilename) Then
Main = DTSStepScriptResult_ExecuteTask
Else
Main = DTSStepScriptResult_DontExecuteTask
End If
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Guzman" <guzmanda@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:7F7312FD-2D2F-487E-944D-8F6558F0233B@xxxxxxxxxxxxxxxx
How can I make a job successful when it contains a DTS package that transfers data from a text file to a SQL Server table and updates the table? The problem is the job should run daily but the file may not always be there
One method is to control the workflow with an ActiveX script. Right-click on your transform data task and select workflow properties-->options-->use ActiveX script-->Properties. Paste a script like your original but with a DTSStepScriptResult value indicating whether or not the the task (and subsequent tasks in the workflow) should be executed. You might also consider adding a text annotation to the package to document the that a workflow ActiveX script property is set.
Function Main()
Dim oFSO, sFileName
sFilename = DTSGlobalVariables.Parent.Connections("File2").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Check for file and return appropriate result
If oFSO.FileExists(sFilename) Then
Main = DTSStepScriptResult_DontExecuteTask
Else
Main = DTSStepScriptResult_ExecuteTask
End If
Set oFSO = Nothing
End Function
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Lhoussain" <lhoussain@xxxxxxxxxx> wrote in message news:46e90dd9$0$31864$426a74cc@xxxxxxxxxxxxxxxHow can I make a job successful when it contains a DTS package that transfers data from a text file to a SQL Server table and updates the table? The problem is the job should run daily but the file may not always be there :
Function Main()
Dim oFSO, sFileName
sFilename = DTSGlobalVariables.Parent.Connections("File2").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Check for file and return appropriate result
If oFSO.FileExists(sFilename) Then
Main = DTSTaskExecResult_Failure
Else
Main = DTSTaskExecResult_Success
End If
Set oFSO = Nothing
End Function
Thank's
Djam
.
- References:
- make a job successful
- From: Lhoussain
- Re: make a job successful
- From: Dan Guzman
- make a job successful
- Prev by Date: RE: Results to Variable
- Next by Date: Re: Importing Excel files with columns > 255 chars
- Previous by thread: Re: make a job successful
- Next by thread: RE: Results to Variable
- Index(es):
Relevant Pages
|