So some background. I have a pair of tables that store 'Application Information' for prospective employees.
The main table is displayed with PHP/SQL and there is a link to 'Delete' an application from the table.
INSERT INTO ResultsOLD SELECT * FROM Results WHERE Results.id = '$IDin'
DELETE FROM Results WHERE Results.id = '$IDin' AND Timestamp = '$INts'
The above entries copy the data to the backup table (old app storage) and deletes the entry from the Main table.
I am now trying to write a recovery page, so that an entry can be returned from the Backup table, back into the Main table (No deletion from Backup Table). I have the following SQL query:
INSERT INTO Results SELECT * FROM ResultsOLD WHERE ResultsOLD.id = '$IDin'
But when I try to run this query off of the new page, it gives an error. I have tried researching the error but I do not understand what it is saying (I am somewhat new to SQL).
This is the error I get:
An explicit value for the identity column in table 'Results' can only be specified when a column list is used and IDENTITY_INSERT is ON.
Is this because I am using the ID in the WHERE, which is the Primary Key? Also when I reinsert the data from the ResultsOLD table, I want to assign a new ID (Primary Key) to the entry but keep everything else intact. The ID is auto-increment, but I think because I am using the ID as the WHERE, it might be trying to insert that also?