dbTalk Databases Forums  

Mapping columns in flat file import

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Mapping columns in flat file import in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
George Sugari
 
Posts: n/a

Default Mapping columns in flat file import - 05-27-2006 , 12:16 PM






Hi all,
I'm new to SSIS and I've just started learning now. I'm trying to import a
comma delimited file in a database table creating a package
programmatically. I got everything working so far except the mappings
between the file columns and database fields in the table. I tried the
sample code that I found in the newsgroups but it doesn't work. I add the
connections, create the data pump task and add the components, set their
properties and initialize their meta data. When I try to map the columns I
don't know how to do it. Are the flat file coulmns parsed by the design
component or should I add them manually?

Here's my code to map the fields:

dataFlowTask.PathCollection.New().AttachPathAndPro pagateNotifications( _
flatfileSource.OutputCollection(0), oledbDestination.InputCollection(0))

' Iterate through the inputs of the component.
For Each input As IDTSInput90 In oledbDestination.InputCollection
' Get the virtual input column collection for the input.
Dim vInput As IDTSVirtualInput90 = input.GetVirtualInput()

' Iterate through the virtual column collection.
For Each vColumn As IDTSVirtualInputColumn90 In
vInput.VirtualInputColumnCollection
' Call the SetUsageType method of the design time destDesignTime of
the component.
Dim column As IDTSInputColumn90 =
destDesignTime.SetUsageType(input.ID, vInput, vColumn.LineageID,
DTSUsageType.UT_READONLY)
destDesignTime.MapInputColumn(input.ID, column.ID,
input.ExternalMetadataColumnCollection(vColumn.Nam e).ID)
Next
Next

But GetVirtualInput returns an empty collection. Is there something I'm
missing here?
I will really appreciate your help.

Thanks,
George



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.