dbTalk Databases Forums  

One to Many - DTS

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


Discuss One to Many - DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
apanchanathan@gmail.com
 
Posts: n/a

Default One to Many - DTS - 05-09-2005 , 05:41 PM






Hi
I have csv file which has about 150 records, I need to load this into
a table.

csv file look like this
pen,80,90 1- record
cup,60,100

Ineed to store into a sql sever table like this
pen 80
pen 90 as 2 records
cup 60
cup 100

I thought of using DDQ. I am really stuck... need some help here


Reply With Quote
  #2  
Old   
Jim Vierra
 
Posts: n/a

Default Re: One to Many - DTS - 05-09-2005 , 05:58 PM






Use FSO to parse script.

read a line
array = split(line,","
walk array and insert records
key = array(0)
for n = 1 to ubound( array)
add record
rec.Fields("drawingobject").Value = key
rec.Fields("objectvalue").Value = array(n)
rec.update
next
loop through file until EOS.

It's pseudo code but it will get you started. You can do it as one script
in DTS or as an external script or you can design a DTS scrip that can feed
mutiple line to the output object. This would be harder if you are not good
at scripting and DTS.
--
Jim Vierra

<apanchanathan (AT) gmail (DOT) com> wrote

Quote:
Hi
I have csv file which has about 150 records, I need to load this into
a table.

csv file look like this
pen,80,90 1- record
cup,60,100

Ineed to store into a sql sever table like this
pen 80
pen 90 as 2 records
cup 60
cup 100

I thought of using DDQ. I am really stuck... need some help here




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

Default Re: One to Many - DTS - 05-10-2005 , 12:26 AM



You may also be able to use this article

Processing The Same Row More Than Once
(http://www.sqldts.com/default.aspx?266)




"Jim Vierra" <jvierra (AT) msn (DOT) com> wrote


Quote:
Use FSO to parse script.

read a line
array = split(line,","
walk array and insert records
key = array(0)
for n = 1 to ubound( array)
add record
rec.Fields("drawingobject").Value = key
rec.Fields("objectvalue").Value = array(n)
rec.update
next
loop through file until EOS.

It's pseudo code but it will get you started. You can do it as one script
in DTS or as an external script or you can design a DTS scrip that can feed
mutiple line to the output object. This would be harder if you are not good
at scripting and DTS.
--
Jim Vierra

apanchanathan (AT) gmail (DOT) com> wrote in message
news:1115678471.631298.51660 (AT) o13g2000cwo (DOT) googlegroups.com...
Hi
I have csv file which has about 150 records, I need to load this into
a table.

csv file look like this
pen,80,90 1- record
cup,60,100

Ineed to store into a sql sever table like this
pen 80
pen 90 as 2 records
cup 60
cup 100

I thought of using DDQ. I am really stuck... need some help here



Reply With Quote
  #4  
Old   
Panch
 
Posts: n/a

Default Re: One to Many - DTS - 05-10-2005 , 04:19 PM



It worked....Thanks Allan


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.