Re: Table with one row
Date: 21 Oct 2005 07:11:13 -0700
Message-ID: <1129903873.643735.174110_at_g44g2000cwa.googlegroups.com>
zeldorblat_at_gmail.com wrote:
> In our system we have a table with one row ("today") that is used
> solely to tell the application what the current processing date is (as
> well as yesterday and tomorrow). The table looks like this:
>
> create table today (
> yesterday smalldatetime not null,
> today smalldatetime not null,
> tomorrow smalldatetime not null,
>
> check ((yesterday < today) and (today < tomorrow))
> )
Does your dbms have a special registers for current_date? In that case you could create a view on top of that:
[db2inst1_at_wb-01 ~]$ db2 "create view today (yesterday, today,tomorrow) as (values (current date - 1 day, current date, current date + 1 day))" DB20000I The SQL command completed successfully.
[db2inst1_at_wb-01 ~]$ db2 "select * from today"
YESTERDAY TODAY TOMORROW
---------- ---------- ----------
2005-10-20 2005-10-21 2005-10-22
1 record(s) selected.
Now there is no need to update, nor check for mnore than one row. Just a thought
/Lennart Received on Fri Oct 21 2005 - 16:11:13 CEST