Import data from 2 txt files into 1 table in DTS | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Import data from 2 txt files into 1 table in DTS

Hi,<br /><br />I need to import data from two text files into one <br />SQL Server table. One data column(which is also a primary<br />key in the SQL Server table<img src=’/community/emoticons/emotion-2.gif’ alt=’:d’ />estination) is common in <br />both text files. How can I transform the data into the table<br />using DTS? Please help!<br /><br />Thanks<br />Ratna
So if I read this right,each table contains different columns for each row, rather than being 2 different sents of data to append to a table. If so, then you have a couple of options, the one I’d find the easiest is to import them into 2 different staging tables, then join them (left/right/inner as is appropriate for your data), import into your destination table, then drop/truncate the staging table. Chris
Thanks Chris, I really appreciate your help.
I had used this technique of staging tables,
since the data is of millions of rows I want
to dump it directly in the destination table.
Do you have any suggestions using DTS packages? Thanks
Not really if you need to join 2 different sets of data as if they were join tables. You can bulk copy (in dts) into a temporary database for very fast response, but then you need still need to join and write to your permanant table. All this can be done in DTS. Your other option is to
1) import one file directly into your table
2) import the other file into a temp table, and then run code that updates those that are exact matches and add those that are new Not sure there is any other way unless the source that created the files can create a single one for you.
True, using DTS you can import/export data to a single table/file and you need to follow other routes as suggested by Chris. Satya SKJ
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Thanks Chris and Satya. You really helped me.
My application is working. Ratna