How to autofill timestamp field with Firebird

I don’t really understand how to do this in LibreOffice 6.1 (Firebird 3 embedded). I did it somehow in HSQLDB embedded like this “alter table “Table1” alter COLUMN…” but it’s not working with Firebird. I saw something about Firebird triggers and words “default value” but how to implement this? All step by step lessons in the web are for old embedded DB. I see that LO is just frontend for FB but it’s not clear for novice where LO ends and FB starts.

Are you trying to change/edit table field/column formats? Why use SQL queries for internal Firebird? It is enough to enter the tab “tables”, call the context menu on the desired table (right mouse button) and call"edit". And change column formats.
And if you are trying to do the same for an external Firebird database, it is better to use the Firebird server Firebird_ISQL_Tool.

Noo… Tried to AUTOFILL with timestamp data… Field was in timestamp format already…

Hello,

You are correct in stating:

but it’s not clear for novice where LO ends and FB starts.

This is also true when using any database. Each database may have its’ own functions but for the most part all follow standards. Unfortunately, depending upon the DB used and its’ version, the standard used may vary.

In situations such as yours, it is best to refer to the DB documentation. For Firebird that is located here → Firebird Documentation. Firebird 2.5 Language Reference (English) is the document you want. Even though Firebird 3.0 is used, this document is the most recent and will give you the necessary information.

As for what you ask, to set an existing timestamp field to default to a current_timestamp value, this will work:

ALTER TABLE YOUR_TABLE_NAME ALTER COLUMN YOUR_FIELD_NAME SET default current_timestamp;

This needs to be run from the menu Tools->SQL...

Aaah… Ok… I see now… just had to change the expression a bit (no special triggers needed)… It works! :slight_smile: