dbTalk Databases Forums  

Related Records in single CSV Import

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


Discuss Related Records in single CSV Import in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew L. Van Slaars
 
Posts: n/a

Default Related Records in single CSV Import - 01-04-2005 , 11:36 AM






Hello,
I am working on an application that interfaces with an AS400. The AS400
programmers I am working with at the client, are not very flexible. They are
providing me with data for the initial database load for the application to
go live. After that my app will take care of all data manipulation. My
problem is, for the initial import, I have a single row in a CSV file that
holds a customer record, it is then followed by three fields for product
information that repeat based on the products that that customer has. I know
the number of fields leading up to the repeating portion and I know that
from that point on, every three fields goes to one record. In my database
the customer record is in a seperate table from the products in a one to
many relationship.
I need to write a script or DTS package that will manipulate the data
and create the related records in both tables. Can this be done? Is there a
simple way to do it? Any hints as to what to try or where to look would be
greatly appreciated. Thanks.



Reply With Quote
  #2  
Old   
Wm. Scott Miller
 
Posts: n/a

Default Re: Related Records in single CSV Import - 01-04-2005 , 11:48 AM






Andrew:

If I understand correctly, you have a file like below:

"customer1","custominfo1","prod1.1","prod1.2","pro d1.3"
"customer2","custominfo1","prod1.1","prod1.2","pro d1.3","prod2.1","prod2.2","prod2.3"
"customer3","custominfo1"
"customer4","custominfo1","prod1.1","prod1.2","pro d1.3","prod2.1","prod2.2","prod2.3","prod3.1","pro d3.2","prod3.3"

Where Customer 1 has one product, Customer 2 has 2 products, Customer 3 has
no products and Customer 4 has 3 products.

Is this correct?

Scott

"Andrew L. Van Slaars" <andrew (AT) vanslaars (DOT) com> wrote

Quote:
Hello,
I am working on an application that interfaces with an AS400. The AS400
programmers I am working with at the client, are not very flexible. They
are
providing me with data for the initial database load for the application
to
go live. After that my app will take care of all data manipulation. My
problem is, for the initial import, I have a single row in a CSV file that
holds a customer record, it is then followed by three fields for product
information that repeat based on the products that that customer has. I
know
the number of fields leading up to the repeating portion and I know that
from that point on, every three fields goes to one record. In my database
the customer record is in a seperate table from the products in a one to
many relationship.
I need to write a script or DTS package that will manipulate the data
and create the related records in both tables. Can this be done? Is there
a
simple way to do it? Any hints as to what to try or where to look would be
greatly appreciated. Thanks.





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.