基于参数/变量的SSIS连接参数 [英] SSIS connection parameter based on parameter/variable

查看:44
本文介绍了基于参数/变量的SSIS连接参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个 SSIS 项目来导入 ~40 个 CSV 文件.我正在为每个导入创建一个包和一个主包来运行它们.

I am building an SSIS project to import ~40 CSV files. I am creating one package for each import and a master package to run them all.

CSV 文件都位于同一个文件位置,但该位置可能会发生变化.我想要做的是为文件位置设置一个项目级参数,并通过将该项目级参数与文件名连接来为每个包的连接构造连接字符串.

The CSV files all live in the same file location, but that location may change. What I would like to do is set a project-level parameter for the file location and construct the connection string for each package's connection by concatenating that project-level parameter with the file name.

这可能吗?

推荐答案

您可以使用表达式连接 SSIS 中的变量.为了得到下面的截图,我创建了 VarA,并给它一个简单的字符串值.

You concatenate variables in SSIS with Expressions. To get to the screenshot below, I created VarA, and gave it a simple string value.

然后我创建了 VarB,将其设为字符串类型,然后单击表达式"框中的省略号:

Then I created VarB, made it a string type, and clicked the ellipses in the Expression box:

您可以在图像中看到我如何将第一个变量与一些文本连接起来以生成第二个变量.

You can see in the image how I then concatenated the first variable with some text to make the second variable.

因此,为了解决您的问题,请将包级参数(文件位置)用作 VarA,并在每个包中使用此技术构建带有该包文件名的 VarB.

So to apply to your question, use the Package-level parameter (file location) as VarA, and in each package, use this technique to build VarB with the file name for that package.

我的示例实际上与您的目标相反,因为我将文件名放在第一个变量中.但它演示了如何连接字符串变量.

My example is actually backwards in relation to your goal since I put the file name in the first variable. But it demonstrates how to concatenate string variables.

这篇关于基于参数/变量的SSIS连接参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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