ADSM-L

Re: [ADSM-L] date check in a select

2010-02-11 12:02:10
Subject: Re: [ADSM-L] date check in a select
From: Ian Smith <ian.smith AT OUCS.OX.AC DOT UK>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 11 Feb 2010 17:00:33 +0000
Richard,

the column reg_time is in datetime format so you need to 'cast' it into the
correct format. Further, you are comparing against an integer. What you
probably want is:

select node_name, date(reg_time) from nodes \
where cast(current_date - date(reg_time) as integer) >30

the first date() is not really necessary.
Note that if you put a space between the greater than operator and the
number, TSM will treat this as a re-direct and write the output to a file
called '30' - no space between >30

There is a manual on pre-version 6 TSM SQL syntax ... somewhere.

HTH
Ian Smith
Oxford. UK

On Thursday 11 Feb 2010 4:46 pm, Richard Rhodes 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.