in Software by (10.3k points) edited by
0 like 0 dislike
3.3k views
I want automatically show current date/time in form and automatic add date/time in table field after saving data. How can i do it? How to I can make automatic default datetime value as current in OpenOffice Base? Me need automatically inserting current date/time.

openoffice base datetime default now
openoffice base auto datetime

1 Answer

0 like 0 dislike
by (10.3k points)

If you only want to show a time stamp on a form, insert a text field so: Form constructor window > Main menu > Insert > Fields.

Through GUI no way add default value to field, only through SQL query.
If you want to store a time stamp together with a new record, add a time stamp field in table and set its default value to CURRENT_TIMESTAMP so: Main window > Main menu > Tools > SQL.

For change of column:

ALTER TABLE "table name" ALTER COLUMN "column name" SET DEFAULT CURRENT_TIMESTAMP

For add of new column:

ALTER TABLE "table name" ADD "column name" TIMESTAMP DEFAULT 'now'

or:

ALTER TABLE "table" ADD COLUMN "column" TIMESTAMP DEFAULT CURRENT_TIMESTAMP

Main window > Main menu > View > Refresh Tables. This is not possible to do in the GUI.

For reference, "OpenOffice Base" default do use "HSQLDB" DBMS. See syntax for it DBMS.

FIRST and AFTER SQL statements don't work in OpenOffice Base (HSQLDB DBMS). I.e. new column always will adding only in end and no way else.

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.