Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-11 Thread BareFeet
Hi Sam Carleton wrote: > This is my first BEFORE INSERT trigger in SQLite and I am getting an > error: > > SQL error: near "new": syntax error > CREATE TRIGGER ti_Customer BEFORE INSERT ON Customer > BEGIN > new.instertedon = DATETIME('NOW'); > new.updatedon = new.instertedon; >

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-10 Thread Igor Tandetnik
"J. King" wrote in message news:op.utpribw4tiq...@odin > On Sat, 09 May 2009 14:37:56 -0400, Igor Tandetnik > wrote: > >> You have two options. You can have an AFTER INSERT trigger that >> updates the freshly inserted record with your desired values. Or,

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-10 Thread J. King
On Sat, 09 May 2009 14:37:56 -0400, Igor Tandetnik wrote: > 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

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Igor Tandetnik
"Sam Carleton" 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

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Sam Carleton
Actually that will not work the long term. I am going to have a update trigger to do the same basic thing and default values will not work there;) I would also really like to enforce on insert that both inserter and updater be the same. Sam On 5/9/09, Swithun Crowe

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Simon Davies
2009/5/9 Sam Carleton : > 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

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Pavel Ivanov
According to the syntax of CREATE TRIGGER statement you can use in the trigger body only insert/update/delete/select statements. There's no support of simple assignments or any other programming language extensions. Pavel On Sat, May 9, 2009 at 11:11 AM, Sam Carleton

Re: [sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Swithun Crowe
Hello SC My goal is that on an insert only the insertedby value is provide. The SC trigger will set that to the updatedby, insertedon and updatedon SC fields. I searched the web and the only examples I could find was of SC an AFTER INSERT, am I better off with that approach? I would think

[sqlite] setting a date in a BEFORE INSERT trigger

2009-05-09 Thread Sam Carleton
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