This is what I came up with -- it seems to work but I don't know how safe
it is:
CREATE TRIGGER [AddMonthToAPSGEN]
AFTER INSERT
ON [APS_Generale]
BEGIN
UPDATE APS_Generale SET nDate = date((SELECT nDate FROM APS_Generale
WHERE rowid=(SELECT max(rowid)-1 FROM APS_Generale)),'start of month','+1
month')
WHERE nDate IS NULL;
END
thanks all for your help,
Gert
2014-02-11 19:12 GMT+01:00 Petite Abeille <[email protected]>:
>
> On Feb 11, 2014, at 7:07 PM, Gert Van Assche <[email protected]> wrote:
>
> > Does anyone know if it is possible for a date field to be automatically
> > incremented with a month when a new record is created?
>
> If you are looking for something wacky, triggers are where to look:
>
> http://www.sqlite.org/lang_createtrigger.html
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
--
Gert Van Assche
*skype: gertva*
*phone: +32 498 84 44 75*
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users