I have a backup like this:
Select * Into BACKUP From ORIGINAL
Then I need to restore some data from that backup, how do I update from that table, I can't Insert Into nor Drop Table because of the Foreign Keys
I have a backup like this:
Select * Into BACKUP From ORIGINAL
Then I need to restore some data from that backup, how do I update from that table, I can't Insert Into nor Drop Table because of the Foreign Keys
This is the basic structure for SQL that will update the ORIGINAL table with the values from the BACKUP table, joining on a presumed common field which would be the primary key. Add a WHERE clause if you don't want every field 'restored'
UPDATE ORIGINAL
SET
Field1 = [BACKUP].Field1,
Field2 = [BACKUP].Field2,
Field3 = .....
FROM ORIGINAL
INNER JOIN [BACKUP] ON ORIGINAL.PKField = [BACKUP].PKField