SSIS读取操作系统环境变量

问题描述 投票:0回答:1

在Windows系统上,当我打开DOS命令窗口时,可以通过运行以下命令来检索操作系统环境变量的值:

C:\ Users \ me>设置MyApplicationEnvironmentMyApplicationEnvironment =登台

我想在SSIS环境中做同样的事情。是否有人对最佳方法有任何想法?

谢谢!

ssis script-task
1个回答
0
投票
创建类型为String,MyApplicationEnvrionment的SSIS变量

添加脚本任务并指定@ [User :: MyApplicationEnvironment]是读/写变量。

假设使用C#,Main的内容将类似于

var env = System.Environment.GetEnvironmentVariable("MyApplicationEnvironment"); if (env != null) { Dts.Variables["User::MyApplicationEnvironment"].Value = env; } // TODO: what should happen if the variable is not found

Environment.GetEnvironmentVariable

我们将其分配给我们要更新的Dts变量的.Value属性。

© www.soinside.com 2019 - 2024. All rights reserved.