Hello Guys,
I've got a requirement I supose to duplicate set of data between a certain date and time for a particular table. I essentialy need to SELECT all records from the table as follows:
I then want to reinsert those records back in to the table, but all of them with a different Unit_ID, lets say, 6 or somthing, all the other columns need to stay the same, and I dont want to delete the old records.
Does that make sense? Almost like a duplication of the records, only with a different Unit_ID. I'm not quite sure of the best process for this. I could do this using my server side code to pull the records and loop them back in with indevidual inserts, but we could be talking a fairly substantial number of records, and I'd rather handle this purely in SQL is possible as its bound to be more efficient.
I look forward to hearing your thoughts,
Rob
I've got a requirement I supose to duplicate set of data between a certain date and time for a particular table. I essentialy need to SELECT all records from the table as follows:
Code:
SELECT Unit_ID
LogRef_ID
DateTime
FROM Message_Log
WHERE Unit_ID = 4
AND DateTime BETWEEN '01-10-2007 13:00:00' AND '20-10-2007 09:00:00'
I then want to reinsert those records back in to the table, but all of them with a different Unit_ID, lets say, 6 or somthing, all the other columns need to stay the same, and I dont want to delete the old records.
Does that make sense? Almost like a duplication of the records, only with a different Unit_ID. I'm not quite sure of the best process for this. I could do this using my server side code to pull the records and loop them back in with indevidual inserts, but we could be talking a fairly substantial number of records, and I'd rather handle this purely in SQL is possible as its bound to be more efficient.
I look forward to hearing your thoughts,
Rob