vendredi 28 novembre 2014

MySQL created_by or updated_last-by


I've been giving the task of taking SQL DDL from data modeler and to transcribe it into mySQL for an internship. The only thing I cannot figure out is how to take



Created_By VARCHAR2(30) DEFAULT USER,


and turn that into sql my resolution was just to do a trigger but now the trigger doesn't work



/* Triggers for User Creation */
DELIMITER //
CREATE TRIGGER menu_creator_tr
BEFORE INSERT ON Menu
FOR EACH ROW BEGIN
NEW.Created_By = USER();
END
DELIMITER;


it states that NEW.Created_By is missing a colon. I am very confused now. Just started learning sql and so i am lost. Some help for both problems is what I am looking for to learn, but a help on either or will help me finish this. I really need to know this though for I have more columns that are similar.





Aucun commentaire:

Enregistrer un commentaire