如何将连接字符串传递到 SSIS 文件中? [英] How to pass a connection string into an SSIS file?

查看:30
本文介绍了如何将连接字符串传递到 SSIS 文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用导入和导出向导创建了一个 SSIS 文件.使用该向导似乎将连接字符串硬编码到 SSIS 文件中;我想要做的是将连接字符串传递到文件中,以便我可以配置目标数据库.有人知道怎么做吗?

I have an SSIS file created using the Import and Export wizard. Using that wizard seems to hard-code the connection string into the SSIS file; what I'd like to do is pass the connection string into the file so that I can configure the target database. Anybody know how to do this?

edit 更多信息:从技术上讲,我有 17 个 SSIS 包,我使用 dtexec 从 PowerShell 脚本执行这些包.我希望 PowerShell 脚本/dtexec 能够将连接字符串传递到每个 SSIS 包中.我使用 SQL Server 导入/导出向导创建了这些包.

edit A little more info: Technically I've got 17 SSIS packages that I am executing from a PowerShell script using dtexec. I'd like the PowerShell script/dtexec to be able to pass the connection string into each SSIS package. I created these packages using the SQL Server Import/Export wizard.

推荐答案

假设包在 C:\ssis 中,您的连接管理器名为 MyConnectionManager,这将覆盖该值并将其指向 localhost.

Assuming the package is in C:\ssis, your connection manager is named MyConnectionManager, this will override the the value and point it to localhost.

dtexec /file C:\ssis\pkg1.dtsx /conn "MyConnectionManager";"\"Data Source=localhost\TestSQL2008R2;Initial Catalog=ConnDB;Integrated Security=SSPI;\""

这篇关于如何将连接字符串传递到 SSIS 文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆