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:
ALTER TABLE "TableName" ALTER COLUMN "ColumnName" SET DEFAULT CURRENT_TIMESTAMP

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.

8 comments:

  1. want completely off this site Help

    ReplyDelete
  2. I feel really nice reading these articles I mean there are writers that can write good material.Epoch time

    ReplyDelete
  3. Such a great blog and all the writings. Can’t help thinking about the author. Binary to decimal

    ReplyDelete
  4. http://freesoftsfiles.com I’m trying to determine if it’s a problem on my end or if it’s the blog. Any suggestions would be greatly appreciated.

    ReplyDelete
  5. I’m trying to determine if it’s a problem on my end or if it’s the blog. Any suggestions would be greatly appreciated. /libreoffice-5-3-4-download-free

    ReplyDelete