Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help re-mapping source columns 1

Status
Not open for further replies.

Sweenster

MIS
Sep 9, 2005
58
GB
Hi,

I am creating a DTS package that loops through and imports 2 types of text files (5 of Type 1 and then 5 of type 2) to the same staging table using a single data pump but hit problems when I reach the 2nd file type as 4 of the source column names are not the same as the first file type.

I am able to define global variables and set the source filename OK but the actual transformation fails with an error like
'Source Column "Invoice Number" can not be found'

Here is a snippet of the ActiveX transformation that I am using...
Code:
'These Column names are same in both file types
DTSDestination("ProductCode") = DTSSource("ProductCode")
DTSDestination("OrderUnit") = DTSSource("OrderUnit")

'These Column names differ
IF DTSGlobalVariables("LoopCounter").Value  < 6 THEN 'e.g 1st file type
DTSDestination("InvoiceNumber") = DTSSource("InvoiceNumber")
Etc…
Etc..
ELSE 'e.g 2nd file type

DTSDestination("InvoiceNumber") = DTSSource("CreditNumber")
Etc…
Etc..
END IF

I thought this would be enough but do I some how have completely re-map source columns as well?

I guess worst case I could duplicate all the steps and run the 2 completely separately but wanted to try an reuse steps if possible.

Any Help would be much appreciated..

 
Are you pulling in column headings as the first row of the Source Table. If so, I would try ingoring the first row when importing the file. This should bring in all columns using the default column names ("col001"), ("col002")etc...

Unfurtunately the transformation task does map column to column so if you assign a name to the Source column, it can't be overridden.
 
Thats does the trick. Thanks
A touch frustrated wiy myself as it was staring me in the face all the time! :)
 
Glad to help!

I know the feeling... Sometimes the most obvious things are the last ones I try :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top