如何修改SSIS中的变量? [英] How to modify the variable in SSIS?

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

问题描述

我有一个简单的字符串变量,其值如下:C:\Test.txt".现在我想编辑变量以指向不同的文件.我找不到办法做到这一点.我可以更改名称、数据类型,但不能更改值本身!我需要删除变量并创​​建新变量吗?

I have a simple String variable with the following value: "C:\Test.txt". Now I would like to edit the variable to point to a different file. I cannot find a way to do that. I can change the Name, Data Type, but not the value itself! Do I need to delete the variable and create the new one?

更新:该问题是由ReadOnly"属性设置为True"引起的.对于典型场景,请参阅下面已接受的答案.

Update: The problem was caused by "ReadOnly" property set to "True". For typical scenarios, see the accepted answer below.

推荐答案

如果您想在设计器中更改它,只需右键单击可用空间和 --> 变量.

If you want to change it in designer just right click on free space and --> Variables.

但是如果您想在运行时更改它,我建议您:

But if you want to change it at runtime I suggest you to:

  1. 创建脚本任务
  2. 选择语言
  3. 将您的变量添加到 ReadWriteVariables.
  4. 编辑脚本.
  5. 例如在 VB 中:

  1. create script task
  2. choose language
  3. add your variable to ReadWriteVariables.
  4. Edit script.
  5. For example in VB:

Dts.Variables("myVariable").Value = @"C:\Test2.txt";

Dts.TaskResult = ScriptResults.Success

这篇关于如何修改SSIS中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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