I created this query:
CREATE TRIGGER trg_vendorsaudit ON vendors2 FOR DELETE AS BEGIN INSERT INTO vendorsaudit (vend_id, vend_name, datedeleted) SELECT vend_id, vend_name, GETDATE() **FROM DELETED** END I needed to create a TRIGGER is called when a DELETE to the vendors occurs. The process INSERTS the rows triggered for deletion into the vendorsaudit table.
I was wondering why in my query the FROM statement is from DELETED. Where does that come from? I don't have a table name deleted.
https://stackoverflow.com/questions/66434678/sql-delete-insert-after-statement March 02, 2021 at 02:59PM
没有评论:
发表评论