dbTalk Databases Forums  

Different columns in text file

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


Discuss Different columns in text file in the microsoft.public.sqlserver.dts forum.



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

Default Different columns in text file - 03-25-2005 , 09:55 AM






I have data in text file , delimited with Pipe and with help of DTS package
pump data to SQL server.

The issue is, the text file some rows can have 32 columns and some can be
33 columns and so on. Number of columns range from 32 - 40. How do i tell
DTS package (vbscript) to recognize the column number if it is not fixed ?

Can i specify in each row after 32 column, how extra columns i have ...
for example
32column | 2 | 50| 40

In above example after 32 column , next column says 2 which means i have
extra 2 column to pump data. Will this idea work ?

Any help gurus ?

Thanks,
Krish



Reply With Quote
  #2  
Old   
Axel Dahmen
 
Posts: n/a

Default Re: Different columns in text file - 03-26-2005 , 09:46 PM






It is not possible to do that just as it is not possible to have a table
with different number of columns per row.

I'd suggest to create a first row containing the maximum number of columns
so that the import interface will know the number of columns. If, during
import, following rows do not contain as much columns, I guess their value
will be NULL.

HTH,
Axel Dahmen


---------------------------
"Krish" <NOspam (AT) Nospam (DOT) org> schrieb im Newsbeitrag
news:e1HImMVMFHA.1172 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
I have data in text file , delimited with Pipe and with help of DTS
package
pump data to SQL server.

The issue is, the text file some rows can have 32 columns and some can be
33 columns and so on. Number of columns range from 32 - 40. How do i tell
DTS package (vbscript) to recognize the column number if it is not fixed ?

Can i specify in each row after 32 column, how extra columns i have ...
for example
32column | 2 | 50| 40

In above example after 32 column , next column says 2 which means i have
extra 2 column to pump data. Will this idea work ?

Any help gurus ?

Thanks,
Krish





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.