Forum > Databases

[solved] Not NULL - not zero pls!

(1/6) > >>

Nicole:
I have a field of the type TDate (Firebird), which must not be NULL, fine.

And yes, it is not NULL, but - sobb -  '01.01.1800' (or símilar).

How can I make sure, that the double value behind the date must not be zero?
I want to enforce it within my firebird database (at the time version 2.5.)

I use FlameRobin the very recent version and used IBExpert (uninstalled) before. So I am not sure, how to do it exactly within FlameRobin, if there is a way, what is probably the case.

Thaddy:

--- Quote from: Nicole on November 26, 2022, 04:02:11 pm ---And yes, it is not NULL, but - sobb -  '01.01.1800' (or símilar).

--- End quote ---
It can never be that date. "similar" will give you the correct date.... as a valid default.
Defining not null ( is Pascal speak not nil) will try to insert a valid value, in this case start of time count.
Depending on platform the year is either 1899 or 1970.
In database terms, null means never accessed or possibly dropped and reset.  zero is not null.

Martin_fr:
I don't know Firebird... But here are a couple of general thoughts.

Many Databases have a "no default" for the declaration of a field. Together with "not null" this means the application must submit a value. However it will not stop the app to submit nonsensical values.

The firebird docs on "create table" shows that there is " CHECK (<check_condition>)". So you should be able to give a minimum value for the date.

Nicole:
found it in Flamerobin!
Thank you, this works fine.
I just had to write there
dateField  > '1.1.1960'
and this keeps my db clean now.

Thaddy:
I don't think so..... :(

Navigation

[0] Message Index

[#] Next page

Go to full version