DELIMITER $$
CREATE TRIGGER DELETETRIGGER AFTER DELETE ON WORKLOG
FOR EACH ROW
BEGIN
INSERT INTO WORKLOGCOPY (Log_ID, Order_ID, Employee_ID, Client_ID,
Work_Completed, Hours_Taken, Date_Logged)
VALUES(OLD.Log_ID, OLD.Order_ID, OLD.Employee_ID, OLD.Client_ID,
OLD.Work_Completed, OLD.Hours_Taken, OLD.Date_Logged)
END$$
DELIMITER ;
我遇到了错误:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'END' at line 6
尝试过弄乱语法以匹配我见过但没有运气的示例。
如果有帮助,请在phpmyadmin上使用MySQL。
谢谢。
答案 0 :(得分:1)
您在;
末尾缺少INSERT INTO
DELIMITER $$
CREATE TRIGGER DELETETRIGGER AFTER DELETE ON WORKLOG
FOR EACH ROW
BEGIN
INSERT INTO WORKLOGCOPY (Log_ID, Order_ID, Employee_ID, Client_ID,
Work_Completed, Hours_Taken, Date_Logged)
VALUES(OLD.Log_ID, OLD.Order_ID, OLD.Employee_ID, OLD.Client_ID,
OLD.Work_Completed, OLD.Hours_Taken, OLD.Date_Logged);
END$$
DELIMITER ;