me salta error #1064 (linea 8) (solucionado) (faltaba BEGIN y END)
me salta error #1582 - Incorrect parameter count in the call to native function 'LPAD' (faltaba una coma) Graciass
Código
CREATE DEFINER=`root`@`localhost` TRIGGER `new_trigger` BEFORE INSERT ON `tabla1` FOR EACH ROW BEGIN DECLARE con INT; SET con = (SELECT COUNT(id)+1 FROM tabla1 WHERE YEAR(fecha) = YEAR(CURDATE())); SET NEW.id = CONCAT(LPAD(con, 5 '0'), '/', YEAR(CURDATE())); END;