ADSM-L

Re: [ADSM-L] date check in a select [using days(...) function]

2010-02-11 15:11:25
Subject: Re: [ADSM-L] date check in a select [using days(...) function]
From: James R Owen <Jim.Owen AT YALE DOT EDU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 11 Feb 2010 13:01:48 -0500
I use this variant: [?equivalent to M.Green's?]

select node_name, reg_time from nodes-
where days(current_timestamp)-days(reg_time)>30
--
Jim.Owen AT Yale DOT Edu   (w#203.432.6693, c#203.494.9201, h#203.387.3030)

Michael Green wrote:
Try this:
select node_name, reg_time from nodes where
cast((current_timestamp-reg_time)days as decimal)>30
--
Warm regards,
Michael Green


On Thu, Feb 11, 2010 at 6:46 PM, Richard Rhodes
<rrhodes AT firstenergycorp DOT com> wrote:
What's the best way to write a date check like this?    I'm looking
for any nodes registered after some number of days (the 30 is just an
example).

dsmadmc -se=$i -id=$adminid -password=$adminpwd -tab -noc <<EOD
     select node_name, reg_time from nodes  where reg_time \> 30 days
EOD


ANR2916E The SQL data types TIMESTAMP and INTERVAL DAY(9) are incompatible
for operator '>'.

                                                             |
        .....................................................V........
        select node_name, reg_time from nodes where reg_time > 30 days



Thanks

Rick

-----------------------------------------
The information contained in this message is intended only for the
personal and confidential use of the recipient(s) named above. If
the reader of this message is not the intended recipient or an
agent responsible for delivering it to the intended recipient, you
are hereby notified that you have received this document in error
and that any review, dissemination, distribution, or copying of
this message is strictly prohibited. If you have received this
communication in error, please notify us immediately, and delete
the original message.