I have an SQLite table with a STRING type column named "NOTES". I want to create a trigger that automatically updates the content of the NOTES column, but doesn't replace it entirely.
The following does not work, I do not see errors, the NOTES column just never gets updated.
CREATE TRIGGER AlterNote
AFTER INSERT ON MyTable
FOR EACH ROW
BEGIN UPDATE MyTable
SET NOTES= NOTES || 'DATEMODIFIED: ' || date('now')
WHERE rowid=NEW.rowid;
END;
This does work presumably because I am no longer referencing the thing I'm updating:
CREATE TRIGGER AlterNote
AFTER INSERT ON MyTable
FOR EACH ROW
BEGIN UPDATE MyTable
SET NOTES= 'DATEMODIFIED: ' || date('now')
WHERE rowid=NEW.rowid;
END;
Is there a way to do this? Basically NOTES=NOTES+"blah"
Aucun commentaire:
Enregistrer un commentaire