SSIS:在数据流中使用 System::TaskName

SSIS: Use System::TaskName inside the dataflow(SSIS:在数据流中使用 System::TaskName)
本文介绍了SSIS:在数据流中使用 System::TaskName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于更详细的日志记录,我想检索 [System::TaskName]

For more detailed logging, I want to retrieve the [System::TaskName]

现在,当从失败的任务开始时,我们转到脚本任务",在那里我获取 [System::TaskName] 并将其写入日志.从逻辑上讲,这会写入当前的 TaskName = 'Script task' 而不是失败的任务

Right now, when starting from the task that fails we go to 'script task', there I fetch [System::TaskName] and write that in the log. Logically this writes the current TaskName = 'Script task' instead of the failed task

问题是 System::TaskName 只知道在任务内部,逻辑上...事实上,我想从数据流内部更新一个变量User::CurrentTaskName",= 从任务内部.

Problem is the System::TaskName is only know inside the task, logical... In fact I want to update a variable 'User::CurrentTaskName' from inside the dataflow, = from inside the task.

如果我可以在数据流中使用脚本任务"组件,这将是最简单的,但我找不到.可能我需要一个解决方法.

This would be easiest if I could use a 'Script Task' component inside a dataflow but I can't find that. Probably I need a workaround.

希望你们大致明白我的意思...

Hope you guys understand approximately what I mean...

提前致谢!

推荐答案

我能够通过在脚本组件中添加以下内容来访问 TaskName.

I was able to access the TaskName by adding the following inside a Script Component.

Private Function ReadVariable(ByVal varName As String) As Object
    Dim result As Object
    Try
        Dim vars As IDTSVariables100
        Me.VariableDispenser.LockForRead(varName)
        Me.VariableDispenser.GetVariables(vars)
        Try
            result = vars(varName).Value
        Catch ex As Exception
            Throw ex
        Finally
            vars.Unlock()
        End Try
    Catch ex As Exception
        Throw ex
    End Try
    Return result
End Function

然后像这样访问变量

ReadVariable("System::TaskName")

这篇关于SSIS:在数据流中使用 System::TaskName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)