1

With MySQL 5.1.43.

I am trying to create a trigger like this:

USE `databaseA`;
DELIMITER $$

CREATE DEFINER=`root`@`localhost` trigger triggerName 
BEFORE INSERT ON tableA
FOR EACH ROW BEGIN

IF(convert(new.subTime, signed) > '600') THEN
SET new.fieldA = new.fieldB;
END IF;

END$$

When I insert a record the fieldA field does not update.

Is there something wrong with my syntax?

Can I use the CONVERT statement in the trigger?

John M
  • 14,338
  • 29
  • 91
  • 143
  • This SO question has a similar problem: http://stackoverflow.com/questions/1211792/mysql-trigger-to-update-a-field-to-the-value-of-id – John M May 26 '10 at 15:58

1 Answers1

0

I just tested your trigger and it works fine. Is there any error message? Also take a look at INFORMATION_SCHEMA -> TRIGGERS and check is your trigger defined properly.

Piotr Pankowski
  • 2,396
  • 1
  • 15
  • 18