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 <swit...@swithun.servebeer.com> wrote: > 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 > SC not. > > How about using default values when you create the table, e.g. > > 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 DEFAULT CURRENT_DATE, > updatedby CHAR(50) NOT NULL, > updatedon DATE DEFAULT CURRENT_DATE, > UNIQUE (username)); > > You can then do an insert as: > > INSERT INTO Customer (insertedby, updatedby) VALUES('me', 'me'); > > i.e. pass the same value for both columns. > > Hope this helps. > > Swithun. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Sent from my mobile device _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users