问题
I was not able to find a resource discussing this from the SQL Agent and SSIS Catalog.
I'm getting behavior that was unexpected when running a package from SQL Agent. I believe that the issue is that I specified a different InitialCatalog property in the sql agent configuration than I used in my connection string environment variable.
Here you can see my connection string is different.
I was expecting that the ConnectionString would override the InitialCatalog, but it does not seem to be the case.
Which one really overrides the other? Can that behavior be altered? It does not appear that I can omit an InitialCatalog value, but is it actually possible?
回答1:
If you modify a value in the properties windows for a connection manager, it will update the connection string immediately.
The SQL Server Agent has no connection strings (it runs different types of jobs/steps). In this case, it calls DTSExec, which in turn executes the SSIS package.
If you want to override the a property for a connection manager dynamically, then you may want to look at these other questions:
SSIS how to set connection string dynamically from a config file
Quickly changing SSIS-packages data source parameters for easy migration
来源:https://stackoverflow.com/questions/29125854/ssis-2012-sql-agent-job-connectionstring-vs-initialcatalog