How to parameterize database connection string in an SSIS package?

后端 未结 3 2042
夕颜
夕颜 2020-12-31 12:23

I have a SSIS package built in Business Intellegience Development Studio which have both source and destination database specified. Now I want to use some variables to param

相关标签:
3条回答
  • 2020-12-31 12:45

    You can right-click on any connection on the project or package and "Parameterize" all the fields from connection, in project or in package parameters. Connection string differs for OLE DB connection to .NET Providers(SqlClient Data Provider) type, so be careful. We have manage to have one centralized place for connection in Project.params

    0 讨论(0)
  • 2020-12-31 12:49

    You need to define "expressions" in the connection manager which then substitute into server/database.

    You can't use variables directly quite often in SSIS

    See "Using Variables in Packages" whcih links to Using Property Expressions in Packages.

    And after a quick Bingle: http://sqlrs.blogspot.com/2006/03/using-expression-variables-in-ssis.html

    0 讨论(0)
  • 2020-12-31 12:51

    There is a nice post here that details one way of doing this.

    You will need to use a ConnectionManager and set the ConnectionString property of that from a Configuration Package.

    The ConnectionString property is a fully qualified database connection string, like

    Data Source=localhost;Initial Catalog=SSISConfig;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;
    

    There are a few gotchas and annoyances with using configuration packages so you may have to fiddle around a bit. I'd be more detailed but it has been about a year since I last worked on an SSIS project.

    If you have any specific problems, please come back and comment about what you've hit. I'll try and refire the old memories.

    0 讨论(0)
提交回复
热议问题