Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 569
  • Last Modified:

Correct method for using DTS to append table through CSV import

I can import a CSV fine using the text driver  in DTS fine.  My problem is that in order for it to not duplicate the data I have to issue a delete all command prior to the import.  If I dont then it just doubles the data up.

Can anyone suggest a method whereby the data would be appended / added using DTS.

Thanks in advance.

Andrew.
0
andrewmilner
Asked:
andrewmilner
2 Solutions
 
dbbishopCommented:
Not sure I understand. If you do not delete data before doing the data transformation, it will append data. But you say you don't want to do that because you get duplicate data. Then you ask if there is a way to append data. I'm confused.

Firstly, I would recommend doing a TRUNCATE TABLE instead of DELETE.
Secondly, if you mean is there a way to only insert 'new' rows (those that don't match a current 'key', then not efficiently. It could be done by doing the transformation through an ActiveX script in which you open another connection to the database and run a query on a row-by-row basis to see if the record already exists. I would not recommend it though as it would involve a lot more resources that truncating the table and bulk inserting the data back into it.
0
 
matrix_aashCommented:
I think the way you want to design your DTS is possible but it will take lot of resources and it will just become a tidious process.

The best way is to delete the table before the import of CSV files.

It works fine and there 100% gurantee of no duplication as you are deleting the data from the table prior to import

Please let me know if this helps.

Aash.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now