Help with ADO

Started by
1 comment, last by b3rs3rk 17 years ago
I'm writing a small programm in C++ with ADO. Basically i'm trying to insert some tables from a DB in another DB. So i've started with something like this: INSERT INTO dest_table SELECT * FROM src_table IN "c:\src.mdb" Naturally, this works perfectly. But sometimes dest_table already has some records, so if i try to insert again those records (don't ask why, but it could happen) i get an error. What i need is a function that selects the record from src_table that aren't already in dest_table, something like (warning: veeeery pseudo-code :D ) INSERT IN dest_table SELECT * FROM src_table AND NOT IN dest_table Anyone can help?
Advertisement
why not do this:

1.) Query target table for elements you are adding
2.) Remove any elements that already exist from your adding list
3.) Insert the unique elements into the table
i've tryied something like this, creating a temporary table, copying the values and removing the duplicates with DELETE. After all i copied all the unique records in dest_table and used DROP to remove the temp table.

Works well, but the resulting DB is enormous! Seems that the temporary data (records and table) is not deleted, but only hided...

This topic is closed to new replies.

Advertisement