收录日期:2019/10/22 14:32:05 时间:2009-11-11 04:19:35 标签:sql,sql-server,triggers
   id    country_name   region     area         population

    1   LASvega      Americas	   2314	      2134562	 
    2   California   AMERICAS	   10101      2134562	
    3   Algeria	     Middle East   24000000   32900000	
    4   Andorra	     Europe        468	      64000

fire a delete query , just before that this trigger is fired and saved that said record into another table.. if i want to delete record no 3 then saved it into another table.

You can use the special Deleted table that is available within an UPDATE or DELETE trigger.

CREATE TRIGGER trg
ON tbl
FOR DELETE

INSERT INTO OtherTable
   SELECT * FROM Deleted