Subject | Re: [ib-support] define date |
---|---|
Author | Claudio Valderrama C. |
Post date | 2002-03-22T08:26:08Z |
"Daniel Bertin" <bertin@...> wrote in message
news:5.1.0.14.0.20020321221400.02b866d0@......
default current_date
is enough.
The default only takes place if the client doesn't include the column in the
insert statement. If the client sends NULL, NULL is stored. If you want to
replace NULL by current_date, you have two choices:
- test for null in a trigger (for both insert and update) and change the
input field before it gets stored
- make the field not null and force the client to send the date always. In
this case, the client's date may be different than the server.
I found that the SQL standard allows this:
insert into tbl(a, b) values(10, DEFAULT);
and you guess what default means. We may support it in the future.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
news:5.1.0.14.0.20020321221400.02b866d0@......
> Hi all,If this is dialect 3,
> How should I define a date field so that I can enter a blank (no value )
> into my table.
>
> I tried;
> CREATE DOMAIN T_DATE AS DATE DEFAULT 'NOW' NOT NULL;
default current_date
is enough.
The default only takes place if the client doesn't include the column in the
insert statement. If the client sends NULL, NULL is stored. If you want to
replace NULL by current_date, you have two choices:
- test for null in a trigger (for both insert and update) and change the
input field before it gets stored
- make the field not null and force the client to send the date always. In
this case, the client's date may be different than the server.
I found that the SQL standard allows this:
insert into tbl(a, b) values(10, DEFAULT);
and you guess what default means. We may support it in the future.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing