I've created a Windows app in VS 2008 using vb.net, that executes an ssis package. It runs OK, here is my code:
Function ExecuteSSIS()
'this funtion executes an SSIS package,
'and returns the results of the execution
Dim pkgLocation As String
Dim pkg As New Package
Dim app As New Application
Dim pkgResults As New DTSExecResult
pkgLocation = "C:\GLODAR\GLODAR\GLODAR.DTSX"
pkg = app.LoadPackage(pkgLocation, Nothing)
pkgResults = pkg.Execute
Return pkgResults
End Function
My question has to do with the value returned and stored in pkgresults. I'm understanding that it's limited to only a handful of integers, mainly 0 for success and 1 for package failure. I would like to know:
1. Just WHERE do these "exit codes" (or maybe they're "return values", I'm not sure which) come from? Are they a system variable the package returns to the calling windows app? If it's a system variable, which one? (I'm asking mainly from curiosity here).
2. Secondly, and this is the main thing I need to find out - can the values be changed somehow, to custom values I could set to provide more specific info when my package fails? For example, my package does three things (1) run Script task to verify existence of an excel file (2) Runs data flow task to transfer the Excel data to a flat file (3) executes a file System task to delete the Excel file. If any of these actions fail I want the package to fail, but I would like to return something more specific to the windows program than a 1 for package failure. Like say a "9" for "no Excel file present", "10" for "failed to transfer Excel report to flat file" and "12" for "failed to delete the Excel File".
3. I'm anticipating people will say customizing the exit code is just not possible. If that is the case, I've seen many examples on Google of executing a package and sending in variables as part of the input. Is there a way to get the generic package result of "1" for failure and also AN OUTPUT USER VARIABLE returned? If there's a way to assign a value to a user variable when some part of the package fails AND GET THAT RETURNED to my vb.net program? If I could get a customized anything back I could have the Windows program display a specific message about why teh package failed, and not have to rely on the generic info that logging provides.
Thanks in advance if there are any takers on this!!
(P.S. - using SQL Server 2008 if it matters).
↧