如何将数据库名称设置为 SSIS 中的变量? [英] How to set database name as a variable in SSIS?

查看:28
本文介绍了如何将数据库名称设置为 SSIS 中的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我当前的项目中,数据库名称不断变化,我不想每次都修改我的 OLE DB 源.因此我想将它设置为一个变量.也就是说,在每个 OLE DB 源中,我都可以将其用作参数.但是,似乎 SSIS 不允许将数据库名称作为参数传输.那么我应该怎么做才能最小化我的更改?

In my current project, the database name keeps changing and I do not want to modify my OLE DB Sources each time. Thus I want to set it as a variable. That is, in each OLE DB Source, I could use it as a parameter. However, it seems SSIS doesn't allow database name to be transferred as a parameter. So what should I do to minimize my changes?

我希望在 OLE DB 源中做这样的 SQL 语句:

I wish to do something like this SQL statement in OLE DB Source:

Select OrderID
  From ?.Order

而且我只需要在更改数据库名称时修改我的变量.感谢您提供任何解决方案!

And I just need to modify my variable when the database name is changed. Thanks for any solutions!

推荐答案

你需要在你的包中添加包配置并将连接管理器的数据库名称设置为配置之一

you need to add package configurations to your package and set the database name of the connection manager as one of the configurations

只需右键单击控制流上的任何空白区域并选择包配置"并按照向导进行操作.

Just right click any blank area on the control flow and select "package configuration" and follow the wizard.

我建议你从 XML 配置开始,因为它更容易理解.

I Suggest you start with a XML configuration because its easier to understand.

这篇关于如何将数据库名称设置为 SSIS 中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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