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

Moving Data from one table to another in SQL

Status
Not open for further replies.

sicollier

Programmer
Jul 29, 2003
4
GB
Hi Guys,

I need to run a sql query to move 5 coloums of data to a bew table from 6months ago. These coloumns are
C1 (int)
C2 (varchar)
C3 (varchar)
C4 (text)
Datetime (timestamp)

I'm new to this, I've been looking at the replace command but don't think thats correct can you help?

Kind Regards
 
one way although potentially dangerous would be to perform a 'mysqldump' on the table to produce a backup '.sql' file then 'LOAD DATA' into the destination table.

Please note the backup sql would need to be edited to remove any DROP TABLE references !! and also the source table name for the new data to be inserted to.

Other than that write a simple script (OS dependent) that reads in the required fields and populates to the destination dB table ... perl would be the ideal for this task.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top