Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 importing from single txt file to multiple tables

Author  Topic 

Maquis
Starting Member

25 Posts

Posted - 2005-02-22 : 10:34:35
I'm trying to import a text file into various SQL tables, depending on the first character on each line. I know I can parse it utilizing ActiveX, and call different functions based on that first character, but I also need the id number returned from the first insert to tie all the related entries together. For example, the first line begins with a "T", there's 25 columns to import, and I need the trans_id from that to import the next line which begins with "L" with 15 columns. I also need it for the next 6 lines that begin with "Q" with 4 columns, and so forth. Then I'll get another line that begins with "T" for the next round of inserts. I've been looking at the Data Driven Query Task, but it's not getting any clearer...any hints? Thanks.

nr
SQLTeam MVY

12543 Posts

Posted - 2005-02-22 : 11:33:27
I would bulk insert into a staging table (with an identity) then insert from there.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -