Bumped by Community user
    Bumped by Community user
    Bumped by Community user
2 improved formatting; removed a tag from the title
source | link

MySQL Before Insert Trigger not firing

DELIMITER $$ CREATE TRIGGER merchant_insert BEFORE INSERT ON merchant_table FOR EACH ROW BEGIN INSERT INTO merchant_seq VALUES (NULL); SET NEW.merchant_id = CONCAT('MC', LPAD(LAST_INSERT_ID(), 10, '0')); END $$ DELIMITER ;

DELIMITER $$
CREATE TRIGGER `merchant_insert` BEFORE INSERT ON `merchant_table` FOR EACH ROW 
BEGIN
  INSERT INTO merchant_seq VALUES (NULL);
  SET NEW.merchant_id = CONCAT('MC', LPAD(LAST_INSERT_ID(), 10, '0'));
END $$
DELIMITER ;

MySQL Before Insert Trigger not firing

DELIMITER $$ CREATE TRIGGER merchant_insert BEFORE INSERT ON merchant_table FOR EACH ROW BEGIN INSERT INTO merchant_seq VALUES (NULL); SET NEW.merchant_id = CONCAT('MC', LPAD(LAST_INSERT_ID(), 10, '0')); END $$ DELIMITER ;

Before Insert Trigger not firing

DELIMITER $$
CREATE TRIGGER `merchant_insert` BEFORE INSERT ON `merchant_table` FOR EACH ROW 
BEGIN
  INSERT INTO merchant_seq VALUES (NULL);
  SET NEW.merchant_id = CONCAT('MC', LPAD(LAST_INSERT_ID(), 10, '0'));
END $$
DELIMITER ;
1
source | link

MySQL Before Insert Trigger not firing

DELIMITER $$ CREATE TRIGGER merchant_insert BEFORE INSERT ON merchant_table FOR EACH ROW BEGIN INSERT INTO merchant_seq VALUES (NULL); SET NEW.merchant_id = CONCAT('MC', LPAD(LAST_INSERT_ID(), 10, '0')); END $$ DELIMITER ;