If you use an INSERT INTO SELECT statement, then you can do it all in one query.

 

INSERT INTO someTable (col1,col2,col3)

SELECT col1,col2,col3

FROM someTable

WHERE ID = ….

 

That will insert one record, if you want to duplicate it multiple times, you can inflate the SELECT query to return more than one record. If this is a frequent need, I would create a table of “templates” and select the values from the template table instead of the data table.

 

Daniel

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Terry Blake
Sent: Thursday, April 21, 2005 1:37 AM
To: [email protected]
Subject: Coping sql database record

 

Is there a way to copy a sql record(s)? Right now I just do a cfquery and then loop over <query>insert...</query> to create the new records. This works but there must be a better way.

 

Thanks for any help!

Terry

Reply via email to