March 17, 2009 at 10:15 am
I'm relatively new to SSIS. I am trying to figure out how to set a package variable "DateExtracted" using a field in my flat file.
In my data flow I have a flat file source, a sort, a conditional split, and a raw file destination. All of this is working fine. I just need to set the value of my package variable "DateExtracted". Can someone suggest a way to do this, which component to use and where.
Thank you,
March 17, 2009 at 10:30 am
Add a script component (of data flow task) between Source & Target components.
The VB.NET Code should be something like:
Imports System
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim varsVariables As Variables
Dts.VariableDispenser.LockOneForWrite("DateExtracted", varsVariables)
varsVariables(0).Value = Row.DateExtracted
varsVariables.Unlock()
End Sub
--Ramesh
March 17, 2009 at 12:04 pm
Ramesh,
I'm trying this, but getting an error that Dts "Name is not declared". I must be missing something here. Here is my code.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Add your code here
'
Dim varsVariables As Variables
Dts.VariableDispenser.LockOneForWrite("varDateExtr", varsVariables)
varsVariables(0).Value = Row.DateExtracted
varsVariables.Unlock()
End Sub
End Class
I apologize if this is a stupid question. Thanks for your help!!!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply