ADSM-L

Re: Select Statement syntax?

2005-08-15 18:51:54
Subject: Re: Select Statement syntax?
From: Andrew Raibeck <storman AT US.IBM DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Mon, 15 Aug 2005 15:51:34 -0700
Hi Joni,

The timestamp format is:

   'yyyy-mm-dd hh:mm:ss.nnnnnn'

where:

   yyyy = year
   mm = month
  dd = day
  hh = hours
  mm = minutes
  ss = seconds (optional)
  nnnnnn = fraction of a second (optional)

When referring to a timestamp, put it in single quotes and use the above 
format, i.e.:

   '2005-08-19 12:00:00'
      or
   '2005-08-19 12:00'

When comparing the date part, you can use:

   '2005-08-19'

When comparing the time part, you can use:

   '12:00:00'
      or
   '12:00'

(note that the fractions of a second are unnecessary and not required.)

So using your example, you could say:

   date(start_time) = '2005-08-19' and time(start_time) >= '12:00'

But break this up into two tests when one will do?

   start_time >= '2005-08-19 12:00'

Regards,

Andy

Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.ibm DOT com

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.

"ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU> wrote on 2005-08-15 
09:49:17:

> 
> Hello Everyone!
> 
>       I have this script that I run once/day, but we are moving servers 
and
>       I would like to run this every 15 min. and have a starting point 
of
>       Friday, 8/19 at noon.  How would I change the start_date and
>       start_time parameters so that it would look at my specific 
criteria?
>       Any help is appreciated.  Thanks!
> 
>       Current
>       select left(entity,10) as node_name,date(start_time) as
>       date,cast(activity as varchar(8)) as activity,time(start_time) as
>       start,time(end_time) as end,cast(substr(cast(end_time-start_time 
as
>       char(20)),3,8) as char(8)) as ?Duration?,cast(bytes/1024/1024 as
>       decimal(6,0)) as mb,cast(affected as decimal(7,0)) as
>       files,cast(successful as varchar(3)) as success from summary where
>       start_time>=current_timestamp-1 day and activity=?BACKUP? and
>       schedule_name like ?DCMOVE_0819%? order by success,node_name
> 
>       Future????
>       select left(entity,10) as node_name,date(start_time) as
>       date,cast(activity as varchar(8)) as activity,time(start_time) as
>       start,time(end_time) as end,cast(substr(cast(end_time-start_time 
as
>       char(20)),3,8) as char(8)) as ?Duration?,cast(bytes/1024/1024 as
>       decimal(6,0)) as mb,cast(affected as decimal(7,0)) as
>       files,cast(successful as varchar(3)) as success from summary where
>       date(start_time)=08/19/2005 and time(start_time)>=12:00 and
>       activity=?BACKUP? and schedule_name like ?DCMOVE_0819%? order by
>       success,node_name
> 
> ********************************
> Joni Moyer
> Highmark
> Storage Systems
> Work:(717)302-6603
> Fax:(717)302-5974
> joni.moyer AT highmark DOT com
> ********************************

<Prev in Thread] Current Thread [Next in Thread>