Am 02.09.10 21:18, schrieb Pavel Ivanov:
> The correct syntax is
>
> UPDATE sites SET createTime = DATETIME('NOW'), updateTime =
> DATETIME('NOW')
>           WHERE rowid = new.rowid;

Thanks this works.

> So I wonder if you made a typo and actually only createTime were
> updated when updateTime remained unchanged.
>
>
Hm, I don't understand what you meaning, but this trigger get started 
when a new row is added, and there is a second trigger which updates 
only updateTime when a row gets updated....



Michael


> Pavel
>
> On Thu, Sep 2, 2010 at 3:11 PM, Michael Graßl<mich...@grassl.eu>  wrote:
>>   Hello
>>
>>
>>
>> I tried to update 2 colums of my recently added row in my table sites.
>> The colums are createTime and updateTime, but sqlite only sets
>> updateTime, the other colum stay plain. Sqlite doesn't complain about
>> anything so I don't know whats wron.
>>
>>
>> CREATE TRIGGER insert_sites_createTime AFTER INSERT ON sites
>> BEGIN
>>
>> UPDATE sites SET createTime = DATETIME('NOW') AND updateTime =
>> DATETIME('NOW')
>>           WHERE rowid = new.rowid;
>>
>> END;
>>
>> best regards,
>> Michael Grassl
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

Reply via email to