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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -