List:General Discussion« Previous MessageNext Message »
From:Mike Watson Date:March 29 1999 6:32pm
Subject:Copying records from a table and re-inserting them
View as plain text  
I'm using Perl DBI to manage a set of MySQL tables. I want to copy a set of
records from a table and re-insert them with a new radio station id.
Selecting the set of records is no problem, but there is no equivalent of
the SELECT * for the insert command (INSERT INTO *). What I have done is
used show columns to get a list of field names and from this built a string
for the insert command. I don't want to change any timestamp values, which I
don't because I reference those fields in the insert string. I have had to
look at field types and escape special chars in text fields. Now I have hit
another wrinkle. We use a seperate id field as a primary key so I don't want
to insert this value, I want the data base automatically pick a value for
this field. Again, I can do this.

Is there an easier way?

Thanks


Michael Watson
Internet Product Engineering Manager
OnRadio, Inc.
1500 Green Hills Road
Scotts Valley, CA 95066
http://www.onradio.com
mwatson@stripped
1-831-440-0300 ext 185

Thread
Copying records from a table and re-inserting themMike Watson29 Mar
  • Re: Copying records from a table and re-inserting themChristian Mack30 Mar