dbTalk Databases Forums  

Transform ActiveX - Source file may have different number of columns

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


Discuss Transform ActiveX - Source file may have different number of columns in the microsoft.public.sqlserver.dts forum.



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

Default Transform ActiveX - Source file may have different number of columns - 07-11-2005 , 04:26 AM






Hi All,

I have a package with a ActiveX transform data task that sucks a csv
file into a mssql 2000 table. The issue is that the CSV file may have
either 10 (File A) or 20 (File B) columns. What I really want to do is
say:

If FileHeaderInfo = 10 Columns Then
DTSDestination(001) = DTSSource(001)
...
DTSDestination(010) = DTSSource(010)
Else
DTSDestination(001) = DTSSource(001)
...
DTSDestination(020) = DTSSource(020)
End If

Now, I currently can't do this as the package will fail if I setup the
source/destination columns according to File A (10 columns) if a File B
(20 columns) is encountered (as I then can't use columns 11-20).
Likewise, it will fail at runtime if I setup the source/dest as per
File B (20 columns) and a File A is encoutered as it thinks columns
11-20 are missing...

Any ideas? Can this be done?

Cheers
Rob


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Transform ActiveX - Source file may have different number of columns - 07-11-2005 , 01:52 PM






You either have a different datapump for each "Length" and you test the
column amount at the start or you test the column length at the start and
rebuid the datapump each time.

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"RobV" <rvarga (AT) swiftdsl (DOT) com.au> wrote

Quote:
Hi All,

I have a package with a ActiveX transform data task that sucks a csv
file into a mssql 2000 table. The issue is that the CSV file may have
either 10 (File A) or 20 (File B) columns. What I really want to do is
say:

If FileHeaderInfo = 10 Columns Then
DTSDestination(001) = DTSSource(001)
...
DTSDestination(010) = DTSSource(010)
Else
DTSDestination(001) = DTSSource(001)
...
DTSDestination(020) = DTSSource(020)
End If

Now, I currently can't do this as the package will fail if I setup the
source/destination columns according to File A (10 columns) if a File B
(20 columns) is encountered (as I then can't use columns 11-20).
Likewise, it will fail at runtime if I setup the source/dest as per
File B (20 columns) and a File A is encoutered as it thinks columns
11-20 are missing...

Any ideas? Can this be done?

Cheers
Rob




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.