MySQL Forums
Forum List  »  Triggers

Help: trigger to backup a row into another table
Posted by: Pablo Ambram
Date: October 18, 2006 01:14PM

im trying to copy a row before it is deleted in one table into another table on a different database. this is because i need a backup table just in case.

i have something like this:

*BEFORE DELETE*

BEGIN
INSERT INTO mastertemplate_history.deleted
(SELECT * FROM mastertemplate WHERE OLD.CustomerID = OLD.CustomerID)
END

when i delete a record from mastertemplate it copies absolutely all the records before the deletion into the other table.

how could i achieve this?
BTW, i rather not use syntax similar to Values(col1, col2...colN) because i have over 60 columns and i rather not type them all.

thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Help: trigger to backup a row into another table
4832
October 18, 2006 01:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.