Mihai Limbasan <[EMAIL PROTECTED]> wrote:
> Igor Tandetnik wrote:
>> Can you show an example of a trigger that would make these statements
>> work:
>>
>> insert into snapshot (bumf) values ('one');
>> insert into sample(type, used) values ('a', 1);
>> insert into sample(type, used) values ('b', 1);
>>
>> so that, at the end, the two new records in sample table would have
>> snapshotid equal to snapshot.id from the record inserted into
>> snapshot table.
>>
> Sure. I'll use your examples, just making sure to add an id insertion
> in the first statement since the id column isn't specified as
> autoincrement.

But it _is_ specified as INTEGER PRIMARY KEY. If I'm inserting a 
specific Id into snapshot, I'm just going to explicily specify the same 
id when inserting into sample, and I wouldn't need all the song and 
dance you show. The whole issue is that the ID in snapshot table is in 
fact automatically generated.

For more details on the relationship between INTEGER PRIMARY KEY and 
AUTOINCREMENT, see http://sqlite.org/autoinc.html
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925



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

Reply via email to