dbTalk Databases Forums  

csv to multiple tables

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


Discuss csv to multiple tables in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ali-R
 
Posts: n/a

Default csv to multiple tables - 02-22-2005 , 03:58 PM






I have a CSV file like this:

"fieldValue1","fieldValue2","fieldValue3","fieldVa lue4"

I'd like to create a DTS package which dose the following operation on the
CSV file:

1) Inserts "fieldValue1" into **Table1**.field1
2) Inserts "fieldValue2" into **Table2**.field2
1) Inserts "fieldValue3" into **Table3**.field3
1) Inserts "fieldValue4" into **Table4**.field4


So as you can see dts package should be able to insert different fieldValues
into different Tables in one database. Is it possible to Implement such a
thing in DTS?

Thanks for your help.

Ali-R



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: csv to multiple tables - 02-22-2005 , 04:16 PM






In message <#6q4lmSGFHA.2932 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, Ali-R
<AliR (AT) microsft (DOT) com> writes
Quote:
I have a CSV file like this:

"fieldValue1","fieldValue2","fieldValue3","fieldVa lue4"

I'd like to create a DTS package which dose the following operation on the
CSV file:

1) Inserts "fieldValue1" into **Table1**.field1
2) Inserts "fieldValue2" into **Table2**.field2
1) Inserts "fieldValue3" into **Table3**.field3
1) Inserts "fieldValue4" into **Table4**.field4


So as you can see dts package should be able to insert different fieldValues
into different Tables in one database. Is it possible to Implement such a
thing in DTS?

Thanks for your help.

Ali-R

You could do this with the Data Pump Task. You do not have to insert
data into the destination, and by using an ActiveX Script Transform your
could call a lookup for each row. Lookups can be any T-SQL you like and
not even return anything, so make the lookup call a stored procedure,
passing in all the source (column) values and insert them into the
correct tables.

It may be faster to just insert the data into a staging table and write
some T-SQL to INSERT...SELECT the values into the correct table. Call
this via a T-SQL task after the Data Flow.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Ali-R
 
Posts: n/a

Default Re: csv to multiple tables - 02-22-2005 , 04:27 PM



I didn't get what yuo mean by lookup calls,can you provide more explanation
,please?

Thanks for your help.


"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
In message <#6q4lmSGFHA.2932 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, Ali-R
AliR (AT) microsft (DOT) com> writes
I have a CSV file like this:

"fieldValue1","fieldValue2","fieldValue3","fieldVa lue4"

I'd like to create a DTS package which dose the following operation on the
CSV file:

1) Inserts "fieldValue1" into **Table1**.field1
2) Inserts "fieldValue2" into **Table2**.field2
1) Inserts "fieldValue3" into **Table3**.field3
1) Inserts "fieldValue4" into **Table4**.field4


So as you can see dts package should be able to insert different
fieldValues
into different Tables in one database. Is it possible to Implement such a
thing in DTS?

Thanks for your help.

Ali-R


You could do this with the Data Pump Task. You do not have to insert data
into the destination, and by using an ActiveX Script Transform your could
call a lookup for each row. Lookups can be any T-SQL you like and not even
return anything, so make the lookup call a stored procedure, passing in
all the source (column) values and insert them into the correct tables.

It may be faster to just insert the data into a staging table and write
some T-SQL to INSERT...SELECT the values into the correct table. Call this
via a T-SQL task after the Data Flow.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org




Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: csv to multiple tables - 02-22-2005 , 05:37 PM



There is a fair bit in Books Online, but try these as well-

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277)

Data Transformation Services (DTS)
(http://www.databasejournal.com/featu...le.php/1459171)

Looking at Lookups
(http://msdn.microsoft.com/library/de...-us/dnsqlpro2k
/html/sql00l5.asp)


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com
"Ali-R" <AliR (AT) microsft (DOT) com> wrote

Quote:
I didn't get what yuo mean by lookup calls,can you provide more
explanation
,please?

Thanks for your help.


"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote in
message
news:+k0MvQCj86GCFwmP (AT) sqldts (DOT) com...
In message <#6q4lmSGFHA.2932 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, Ali-R
AliR (AT) microsft (DOT) com> writes
I have a CSV file like this:

"fieldValue1","fieldValue2","fieldValue3","fieldVa lue4"

I'd like to create a DTS package which dose the following operation on
the
CSV file:

1) Inserts "fieldValue1" into **Table1**.field1
2) Inserts "fieldValue2" into **Table2**.field2
1) Inserts "fieldValue3" into **Table3**.field3
1) Inserts "fieldValue4" into **Table4**.field4


So as you can see dts package should be able to insert different
fieldValues
into different Tables in one database. Is it possible to Implement such
a
thing in DTS?

Thanks for your help.

Ali-R


You could do this with the Data Pump Task. You do not have to insert
data
into the destination, and by using an ActiveX Script Transform your
could
call a lookup for each row. Lookups can be any T-SQL you like and not
even
return anything, so make the lookup call a stored procedure, passing in
all the source (column) values and insert them into the correct tables.

It may be faster to just insert the data into a staging table and write
some T-SQL to INSERT...SELECT the values into the correct table. Call
this
via a T-SQL task after the Data Flow.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org






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.