It's not a secret anymore!*
The moose likes JDBC and the fly likes select/insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "select/insert " Watch "select/insert " New topic
Author

select/insert

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Does anyone know a good way to move data from one table to another please?
The only one I can think of is to do a SELECT statement and then go through the ResultSet and for each result create an INSERT statement. Seems a bit long-winded...
Many thanks
clement valentine
Greenhorn

Joined: Apr 04, 2002
Posts: 19
I would do it outside the application (using sql) if there is not much transformation/business rules in moving from one table to another.
eg insert into A select * from B
Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
thanks - using a runtime exec command?
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
If you need to do it in the app, you'd be better off using JDBC, and the execute() method of Statement.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: select/insert