This is my first BEFORE INSERT trigger in SQLite and I am getting an error:
SQL error: near "new": syntax error My goal is that on an insert only the insertedby value is provide. The trigger will set that to the updatedby, insertedon and updatedon fields. I searched the web and the only examples I could find was of an AFTER INSERT, am I better off with that approach? I would think not. Here is SQL for the table and trigger: --------------------------------------------------------------- CREATE TABLE Customer ( CustomerId INTEGER PRIMARY KEY AUTOINCREMENT, IsInSlideShow INTEGER NOT NULL, Username CHAR(50) NOT NULL, Password CHAR(50), insertedby CHAR(50) NOT NULL, instertedon DATE NOT NULL, updatedby CHAR(50) NOT NULL, updatedon DATE NOT NULL, UNIQUE (username)); CREATE TRIGGER ti_Customer BEFORE INSERT ON Customer BEGIN new.instertedon = DATETIME('NOW'); new.updatedon = new.instertedon; new.updatedby = new.insertedby; END; _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users