mysql - Trigger isn't working, error inserting into another table upon insert -
i'm attempting insert new record table upon record being inserted primary table. not registering trigger...
delimiter $$ create trigger trigger_insertroleplay on `users` insert begin insert `roleplay_users` ( id ) select id inserted end$$ delimiter ;
the error returned.
create trigger trigger_insertroleplay on `users` insert begin insert `roleplay_users` ( id ) select id inserted end; /* sql error (1064): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'on `users` insert begin insert `roleplay_users` ' @ line 1 */ /* affected rows: 0 found rows: 0 warnings: 0 duration 0 of 1 query: 0.000 sec. */
if using mysql, want this:
delimiter $$ create trigger trigger_insertroleplay after insert on `users` each row begin insert roleplay_users(id) select new.id; end$$ delimiter ;
inserted
sql server uses, not mysql.
Comments
Post a Comment