SQLite Forum

Can DEFAULT be the only possible value?
Login
>`create table t1 (dt as (datetime()) stored, event);`

>In the latter case the value of dt is set when the row is inserted or updated but cannot be set by an insert or update statement.

A bit unfortunate that the user has no control on whether to have the dt take a value only on `INSERT` but remain unchanged on further updates.

In many cases you need the original timestamp for `creation_dt` and update-able timestamps for `change_dt` fields.

Maybe an extension to the syntax could be made to have either `STORED` (when inserted/updated) or `STORED ONCE` (when first inserted).