Punkrulz
Somewhat eXPerienced
- Joined
- 24 Dec 2001
- Messages
- 790
Hey guys,
I'll tell y'all what I have, what I'm doing, and what the problem is so you can understand it better.
Previously I've taught myself a bit of PHP and created mysefl a form with PHP that I could add calls into a database and call them back. I had created 12 seperate pages, 1 for each month for fire calls [it's for my fire department], and 12 seperate tables, one per month. I have recently been told that is bad programming and what I can do to fix it.
So now, I've added another field to the tables I've been working on that would allow me to show all information for a specific month, and sort by the run number, which is the primary key and an auto-incrementing digit.
The problem I'm running into is this: I created the table "2005" with the same fields as the other tables. I've been trying to copy the information out of one table and into 2005, starting with June since that's the first table that has information in it. I've been using the Operations tab under the table I want to copy as the source. There is a conflict though. When I start copying the other months, sometimes the primary key conflicts with another that was previously copied.
Since they were seperate tables, you might find run #2 in June, and run #2 in July. Is there a way that I could use a SQL Script, to copy the information out of the table, and without damaging the existing table [incase anything goes wrong] drop the primary key in the existing table, copy it over to 2005, and then reapply the keys in numerical order? Basically getting assigned a new primary key in the copy process?
Hope you guys understand what I'm talking about, I think that's the easiest way I can explain it. Please let me know if you have any questions, and thanks in advance!
I'll tell y'all what I have, what I'm doing, and what the problem is so you can understand it better.
Previously I've taught myself a bit of PHP and created mysefl a form with PHP that I could add calls into a database and call them back. I had created 12 seperate pages, 1 for each month for fire calls [it's for my fire department], and 12 seperate tables, one per month. I have recently been told that is bad programming and what I can do to fix it.
So now, I've added another field to the tables I've been working on that would allow me to show all information for a specific month, and sort by the run number, which is the primary key and an auto-incrementing digit.
The problem I'm running into is this: I created the table "2005" with the same fields as the other tables. I've been trying to copy the information out of one table and into 2005, starting with June since that's the first table that has information in it. I've been using the Operations tab under the table I want to copy as the source. There is a conflict though. When I start copying the other months, sometimes the primary key conflicts with another that was previously copied.
Since they were seperate tables, you might find run #2 in June, and run #2 in July. Is there a way that I could use a SQL Script, to copy the information out of the table, and without damaging the existing table [incase anything goes wrong] drop the primary key in the existing table, copy it over to 2005, and then reapply the keys in numerical order? Basically getting assigned a new primary key in the copy process?
Hope you guys understand what I'm talking about, I think that's the easiest way I can explain it. Please let me know if you have any questions, and thanks in advance!