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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update table from temporary table

Status
Not open for further replies.

UltraSmooth

Programmer
Oct 28, 2002
97
CA
I have an import process that creates a temporary table and then dumps a large amount of records into it. I need to update an existing table against this temporary table. So where the record exists I either want to update or replace (probably based on parameter but can be a separate query for each) it in the live table, and if it does not exist i want to add it.

The temporary table can contain a large number of records (100000-200000). How can I create a fast and efficient process for doing this? Is there a query I could write to do this or would I have to do this through through code (i'm working in a java environment). I think a query would be faster than processing that many records via jdbc.

Any advice would be appreciated.
 
Hmmmm... I'd look at "replace into mytable select blah blah blah from temptable"

Non-standard sql, but useful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top