"Sam Carleton" <scarle...@miltonstreet.com>
wrote in message
news:8d38ca0a0905090811g7415ebereb4eb241a44e4...@mail.gmail.com
> 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.

You have two options. You can have an AFTER INSERT trigger that updates 
the freshly inserted record with your desired values. Or, you can have a 
BEFORE INSERT trigger that inserts the values you want, then does SELECT 
RAISE(IGNORE); to suppress inserting the original record (one that 
caused the trigger to run in the first place).

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to