D B
asked on
SSIS Determine if Running through VS
SSIS has a system property named System::InteractiveMode that BOL states:
Indicates whether the package is run in interactive mode. If a package is running in SSIS Designer, this property is set to True. If a package is running using the DTExec command prompt utility, the property is set to False.
However, this property appears to always be set to False, even when I am in Visual Studio and running the package interactively. I am using VS2019. I have been playing with this for the past couple of hours and it is starting to drive me crazy.
I need to reliably determine whether the package is running interactively or through our batch console using DTEXEC.exe as I need to set some other package variable based on this value..
Has anyone else run into this situation or come up with a way to reliably (without using user variables) determine whether a package is running interactively or via DTExec?
FYI, when just viewing the variables in the designer, it says the value is False. I would expect it to be True by default if I am actually in VS designer.
Indicates whether the package is run in interactive mode. If a package is running in SSIS Designer, this property is set to True. If a package is running using the DTExec command prompt utility, the property is set to False.
However, this property appears to always be set to False, even when I am in Visual Studio and running the package interactively. I am using VS2019. I have been playing with this for the past couple of hours and it is starting to drive me crazy.
I need to reliably determine whether the package is running interactively or through our batch console using DTEXEC.exe as I need to set some other package variable based on this value..
Has anyone else run into this situation or come up with a way to reliably (without using user variables) determine whether a package is running interactively or via DTExec?
FYI, when just viewing the variables in the designer, it says the value is False. I would expect it to be True by default if I am actually in VS designer.
ASKER
Documentation states: The value is changed only if the package is executed by ISServerExec on the Integration Services Server.
This won't work because we are not executing on IS Server. Executing a package via DTExec on the command line does not set this value. Why isn't System::InteractiveMode working?
This won't work because we are not executing on IS Server. Executing a package via DTExec on the command line does not set this value. Why isn't System::InteractiveMode working?
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d9ba45ab-9607-43cd-942d-e725434cc9ba/ssis-package-interactive-mode?forum=sqlintegrationservices
Could you use the above from a link with a compiler directive?
eg:
Could you use the above from a link with a compiler directive?
eg:
if #debug then
oPackage.InteractiveMode = true;
#endif
ASKER
I have been able to come up with an alternate solution. We have a standard initialization sequence container that has a C# script task. One of the things it does is sets a package variable to the contents of the command line.
I can use the value of this variable since it will be empty if executing the package through VS.
I can use the value of this variable since it will be empty if executing the package through VS.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just a note you can pass in parameters from visual studios as well. So as long as those Params are exclusive you should be fine, its just not the definitive way to always tell if you are running in vs or command line.
https://stackoverflow.com/questions/57664949/how-to-find-out-if-a-package-is-run-locally-in-visual-studio-or-on-the-server
Check the value of System::ServerExecutionID Should be 0 if in VS.