I am stuck in sql, anyone knows why does it point to a syntax error where it says "on"?
delimiter $$
use mydb $$
CREATE TRIGGER NuevaSerie ON `Mydb`.`Serie`
FOR INSERT
AS
INSERT INTO Documento
(Serie_idSerie)
SELECT
idSerie
FROM inserted
end$$
I am trying to create a new row in table Documento, column Serie_idSerie when someone adds a new row to Serie. Thank you.
Your syntax does not correspond to any database. It is a weird mixture of MySQL and SQL Server.
In MySQL, the trigger syntax would look like:
CREATE TRIGGER NuevaSerie AFTER INSERT ON `Mydb`.`Serie`
FOR EACH ROW
BEGIN
INSERT INTO Documento (Serie_idSerie)
VALUES (new.idSerie);
END$$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.