MySQL Forums
Forum List  »  Triggers

to copy values to a new table and delete values from old table
Posted by: cham dev
Date: June 01, 2011 09:51AM

CREATE TRIGGER trigg_msg
ON messagein

FOR insert,delete,update AS
IF EXISTS (SELECT * FROM INSERTED)
BEGIN

INSERT INTO new_message (Phone number,CusID,CusName,CusAddress) values ( SELECT ins.sender FROM inserted ins, SELECT cus.CusID FROM customer cus, SELECT cusname FROM customer cus, SELECT cus.cus_phone number FROM customer cus, SELECT cus.Address FROM customer cus)
DELETE * FROM messagein
END



this trigger is not working.please somebody show me the mistake....

when insert a row to messagein table it should copy the value of sender field and copy it to the new_message table.then other values like cusID,CusName,.. should be retrieve from the customer table. please some one help me.

Options: Reply• Quote


Subject
Views
Written By
Posted
to copy values to a new table and delete values from old table
2943
June 01, 2011 09:51AM


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.