SSIS: Use System::TaskName inside the dataflow

后端 未结 2 1792
长情又很酷
长情又很酷 2021-01-25 05:46

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

Right now, when starting from the task that fails we go to \'script task\', there I fetch [System::T

2条回答
  •  遥遥无期
    2021-01-25 06:07

    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
    

    and then accessing the variable like so

    ReadVariable("System::TaskName")
    

提交回复
热议问题