Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare a sql 7.0 table data with that in a text file

Status
Not open for further replies.

csmanohar

Programmer
Apr 4, 2000
7
US
I have a MS SQL 7.0 table that needs to be updated every time there is a transmission
from our client.
This transmission is in the form of a txt file containing the most current
data.
I need to compare the file with the data currently in the table, identify
the differences, and create a transaction table that can be used to update
the master table after user approves the updates.

My question is this: What is the best/most elegant way to compare the file
data with the table data? The transmission is fairly large, so the
comparison has to be efficient. Is there any proven technique to accomplish
something like this.
Thanks for any suggestion
- Manohar




 
I do some of this now.
I usually load the fields of the text file into variables, and then compare them to the fields in the table.

If there are changes you can decide what to do- add the whole record to your temporary table, add the parts that are different, etc.

I'm not sure of any way to do this on any larger scale than record by record.

My performance issues are not usually involving handling the text file but in accessing the database. Running queries can be slow.

I find most of my performance gains in writing good queries and using the fastest recordset types allowed by my situation.
 
I guess thid method is a good solution if the data file is reasonably small. I too, have considered this method (and will implement it if there are no viable alternatives). But I was hoping there is some method that allows me to compare large volumes of data without worrying abt the performance issues.
Thanks for your suggestion.
-- Manohar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top