Thanks Igor, that's got me going. With regards to the PK, I'm moving from an old MS access database that uses an autonumber field, but has a PK on another unique field and I wanted to keep it the same for ease of conversion, but its not a big deal.
bb Igor Tandetnik wrote: > > "blackbox" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> I'm new to SQLite and triggers. Is it possible to set a trigger so it >> updates a field of a new record in a table to the same value as the >> Autoincrement field. >> >> i.e. >> >> Field1, Integer Autoincrement >> Field2, Integer >> Field3, Text >> Field4, Text >> >> When the user enters text in Field3 & Field4, Field1 is >> auto-populated. When the new record is saved, I would like the >> trigger to set Field2 to be the same as Field1. I have no idea how >> to set the syntax to do this. > > create trigger triggerName after insert on tableName > begin > update tableName set Field2=new.Field1 > where Field1 = new.Field1; > end; > >> Also, is it possible to have an autoincrement field in SQLite that is >> not a primary key? > > No. Why would you want to? > > Igor Tandetnik > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/SQLite---Upade-trigger-tp20648718p20681043.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users