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)
 Using a fixed-width text file to update a database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-20 : 08:34:00
Brian writes "I'm fairly new to SQL so I was hoping you might be able to help me. This is what I'm trying to accomplish. I already have a database with 8 tables designed. I have already used DTS-Import to import a fixed-width file for my initial load of the database. Now, I need to be able to update this database with a fixed-width file that may include new records, but definitly includes updates to pre-existing records. Anytime a new record needs to be added or an existing record needs to be updated, the entire information dealing with this record is being resent via a fixed-width file. Do you have any suggestion and examples on how I might accomplish this task?"

dsdeming

479 Posts

Posted - 2002-05-20 : 08:38:40
It sounds like your best bet is to BULK INSERT into a staging table. Once the data is there, you can easily determine which rows are new and insert them into your production table. The rows in the production table differ from those in the staging table can then be updated. The remainder should be duplicates that can be ignored.



Edited by - dsdeming on 05/20/2002 08:40:02
Go to Top of Page
   

- Advertisement -