In PHPMyAdmin, how can I duplicate a row in a table?
My frequent scenario is that I have a table with about 30 columns, and each cell has a significant amount of data. But sometimes, I need to add a row with very similar data as an existing row.
So, the quickest way to add a row with mostly the same data is to:
1. duplicate it with an incremental primary key, then
2. make the minor change(s) in the new row's cells as I wish.
This is much quicker than adding a new, empty row and then re-typing or copying and pasting into each of the 30 cells.
What would you do in this scenario?
i would do it like this
Rudy, wtf. I posted here because I wanted someone else's opinion. Also, George never answered my question about his question, which seemed to suggest that my question here was basically flawed.
so i guess you didn't like my suggestion?
what was wrong with it?
hey at least it works
If it helps any it's the way I'd do it too.
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc
Rudy & Simon, I wouldn't use this solution because it will take so much time to copy all of the column labels. It would be simpler just to use my Windows clipboard extender Clipcache, copy all the cell values, insert new row, and paste in the duplicate values. Actually, that's the way I do it now.
when i do it, i use CTRL-C to copy them all and CTRL_V to paste them into my text editor, then use a quick search/replace to insert the commas between them
Originally Posted by leafgreen
takes about twelve seconds altogether
i always use a text editor when working with SQL -- typing SQL directly into the SQL window is too much like work
November 29th, 2009, 03:46 PM
Yes, you can
Go in to edit the row you want to copy. Make all the changes as they should appear in the new record. Then, instead of "save", select "insert as new record" and hit GO.
October 29th, 2012, 08:14 PM
Thank You teezeCrost !
I spent about 2 hours trying to figure this out - importing and exporting the sql data, etc.
Your solution was right in front of me all along. I just tried it and it worked great !