Friday, November 16, 2012

OpenOffice / LibreOffice Base timestamp quickie

The built-in database for these is hsqldb.

To setup an automatic timestamp when you enter data.. it cannot be done from the table design view. It must be done from within the "Execute SQL Statement" window. Go to Tools, SQL to get there. Then enter this command:

Replace "TableName" with the name of your table and "ColumnName" with the name of your column. The type of your column should be Date/Time [ TIMESTAMP ].

I find that the case of the SQL commands isn't really that important but it is very particular that you have the correct case for your table name and column name. If you have a table named Contacts, then you must enter "Contacts". It will give you an error if you enter "contacts" instead.

This will cause that column, or field, to be filled with the time & date that the row was inserted to the table. It's possible to set it to insert the time & date on an update as well but I don't need to use that as of yet.