Move records to a history table using Output clause
The following illustrates how to move a record to a history table using the DELETE statement with the OUTPUT clause.-- delete a row
DELETE from a
-- output clause to insert the deleted row to the history table
output deleted.lRowID, deleted.MyField1, deleted.MyField2, deleted.sLastUser, deleted.dtLastMod, deleted.sCreatedBy, deleted.dtCreateDate, deleted.uuid
into Test1_hist (lRowID, MyField1, MyField2, sLastUser, dtLastMod, sCreatedBy, dtCreateDate, uuid)
from Test1 a
where a.lRowID = 1002 -- select a specific record to delete
Last modified by Mohit @ 4/13/2025 8:08:37 PM