![]() |
| ||
| Problem on IF STATEMENT on TRIGGER with MySql Hi Everybody, i found out that to create a trigger i have to remove the BEGIN and END and it works, but as i put an IF STATEMENT inside like this one: CREATE TRIGGER status_history_upd AFTER UPDATE ON projects FOR EACH ROW IF NEW.project_status != OLD.project_status THEN INSERT INTO project_status_history SET status_change_date = NEW.project_edit_date, project_id = NEW.project_id, status_id = NEW.project_status; END IF; for some reason it gives me back this error: MySQL said: #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 'INSERT INTO project_status_history SET status_change_date = NEW.project_edi' at line 5 I really have to put the IF statement because i need to run the INSERT just in some cases. Can someone please help? Thanks Gabriele |
| All times are GMT -4. The time now is 4:14 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC