Ask Your Question
0

How to autofill timestamp field with Firebird

asked 2019-03-12 12:04:42 +0200

Dymskiy gravatar image

updated 2019-03-12 13:00:16 +0200

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.

edit retag flag offensive close merge delete

Comments

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.

Kadet gravatar imageKadet ( 2019-03-12 18:35:31 +0200 )edit

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

Dymskiy gravatar imageDymskiy ( 2019-03-13 13:18:47 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-03-12 19:12:55 +0200

Ratslinger gravatar image

updated 2019-03-12 19:13:59 +0200

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...

edit flag offensive delete link more

Comments

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

Dymskiy gravatar imageDymskiy ( 2019-03-13 13:15:13 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-12 12:04:42 +0200

Seen: 46 times

Last updated: Mar 12