SQLite Forum

select * from t; -- but don't want virtual columns
Login
Example:

```
SQLite version 3.34.0 2020-09-14 08:14:15
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table x(x, last_update as (datetime()) stored, update_sid as (usersid()) stored);
sqlite> insert into x values (1);
sqlite> select * from x;
┌───┬───────────────────────────┬────────────────────────────────────────────────┐
│ x │        last_update        │                   update_sid                   │
├───┼───────────────────────────┼────────────────────────────────────────────────┤
│ 1 │ 2020-09-14 21:01:32.964 Z │ S-1-5-21-2707818823-1216488348-3746780667-1001 │
└───┴───────────────────────────┴────────────────────────────────────────────────┘
sqlite> select * from x;
┌───┬───────────────────────────┬────────────────────────────────────────────────┐
│ x │        last_update        │                   update_sid                   │
├───┼───────────────────────────┼────────────────────────────────────────────────┤
│ 1 │ 2020-09-14 21:01:32.964 Z │ S-1-5-21-2707818823-1216488348-3746780667-1001 │
└───┴───────────────────────────┴────────────────────────────────────────────────┘
```

Whenever a row is added or updated in table x the date of last update and the security identifier performing that update are recorded and cannot be fiddled (usersid() is a UDF that retrieves the Windows Security Identifier of the current/active process authentication token).