Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Program Based on count in SQL table

Status
Not open for further replies.
Mar 12, 2003
678
US
In SSIS is it possible to create a dts package that when a sql table has data in it, the package will run an executable, and the table does not have data it will not run the executable? I am familiar with SSIS but drawing a blank.
 
The way I accomplish conditional executions is by having a master package that contains calls to all my other various packages. I then use a conditional work flow that checks Variable Values to see if the step should execute.

Paul
---------------------------------------
Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Another alternative is to use a Script Task.

Store off the value of your COUNT from your Execute SQL Task into a variable.
Create a Script Task.
On the Script tab, type in your variable's name into the ReadOnlyVariables line.
Click Design Script.
Type in something like this....
Dim startInfo As System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process

Public Sub Main()
If Dts.Variables.Contains("TestEmpCount") = True Then
If CType(Dts.Variables("TestEmpCount").Value, Integer) > 0 Then
Dim startInfo As System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process

startInfo = New System.Diagnostics.ProcessStartInfo("C:\text.txt")

pStart.StartInfo = startInfo
pStart.Start()
pStart.WaitForExit() 'Your code will halt until the exe file has executed.

End If
End If
Dts.TaskResult = Dts.Results.Success
End Sub


That should induce the desired action
 
Edit on my response.....ignore the first 2 dim statements.....they are already in the code later on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top