k******r 发帖数: 2300 | 1 I want to write a trigger. Whenever someone tries to delete the rows of a
table, then the trigger will be fired and those deleted rows will be inserted
into a temp table. In addition, the temp table also need a column to record
the date and time when each row is deleted. Please give me some advices.
Thanks a lot! | aw 发帖数: 127 | 2 if you're using SQL Server.
CREATE TRIGGER [TRIGGER NAME] ON [table_name]
FOR DELETE
AS
INSERT INTO TEMP_TABLE
SELECT *, current_timestamp FROM Deleted
Deleted is a system virtual table in SQL server.
inserted
【在 k******r 的大作中提到】 : I want to write a trigger. Whenever someone tries to delete the rows of a : table, then the trigger will be fired and those deleted rows will be inserted : into a temp table. In addition, the temp table also need a column to record : the date and time when each row is deleted. Please give me some advices. : Thanks a lot!
| k******r 发帖数: 2300 | 3 Thanks a lot!
record
【在 aw 的大作中提到】 : if you're using SQL Server. : CREATE TRIGGER [TRIGGER NAME] ON [table_name] : FOR DELETE : AS : INSERT INTO TEMP_TABLE : SELECT *, current_timestamp FROM Deleted : Deleted is a system virtual table in SQL server. : : inserted
|
|