[thelist] best method for copying records

Chris W. Parker cparker at swatgear.com
Fri Aug 29 18:49:42 CDT 2003


Hi.

Ok so I need take some records and copy them from one table to another
table. I've read about SELECT INTO but this doesn't appear to be what I
need. What's the problem you say? Well I'll tell you.

The problem is that I don't want to copy the entire record but I do at
the same time want to INSERT data into the new record. Confusing? Here's
a quick illustration.

I've got two tables:

OldTable

id
name
date

NewTable

id
name
date


I want to take only 'name' from OldTable and put it into NewTable while
at the same time letting the id field in NewTable increment on it's own
(i.e. not taking the value from OldTable) as well as giving
NewTable.date today's date and not what is stored in OldTable.date.

Since SELECT INTO doesn't seem that it will work (although it will and I
just don't know how to use it properly) the only other solution I
thought of was to SELECT the date I do want to keep from OldTable and
then construct a new INSERT INTO query with the old and new data I want
to put in NewTable.


What do you think you people think about this?


You're the best pals a guy could have.
Chris.


More information about the thelist mailing list