ADSM-L

Re: SQL Select statement help

2004-09-01 05:31:58
Subject: Re: SQL Select statement help
From: "Warren, Matthew (Retail)" <Matthew.Warren AT POWERGEN.CO DOT UK>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Wed, 1 Sep 2004 09:58:37 +0100
Thanks for this. Interesting way of attacking it :)

Matt.

-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Johnson, Milton
Sent: Tuesday, August 31, 2004 10:19 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: SQL Select statement help

You can create a script with the following select statements:
select stgpool_name,'1' as "Days Pending",count(*) as Total from volumes
where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)=1
group by stgpool_name where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)=1
group by stgpool_name 
select stgpool_name,'2' as "Days Pending",count(*) as Total from volumes
where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)=2
group by stgpool_name 
select stgpool_name,'3' as "Days Pending",count(*) as Total from volumes
where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)=3
group by stgpool_name 
select stgpool_name,'4' as "Days Pending",count(*) as Total from volumes
where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)=4
group by stgpool_name 
select stgpool_name,'>=5' as "Days Pending",count(*) as Total from
volumes where status='PENDING' -
        and cast((current_timestamp-PENDING_DATE)days as decimal)>=5
group by stgpool_name 

When you run it you get something like:

STGPOOL_NAME           Days Pending           TOTAL
------------------     ------------     -----------
COPYPOOL               1                         10
TAPEPOOL               1                          9

STGPOOL_NAME           Days Pending           TOTAL
------------------     ------------     -----------
COPYPOOL               2                         10
TAPEPOOL               2                         13

STGPOOL_NAME           Days Pending           TOTAL
------------------     ------------     -----------
COPYPOOL               3                         10
TAPEPOOL               3                         12

STGPOOL_NAME           Days Pending           TOTAL
------------------     ------------     -----------
COPYPOOL               4                         10
TAPEPOOL               4                         11

STGPOOL_NAME           Days Pending           TOTAL
------------------     ------------     -----------
COPYPOOL               >=5                        0
TAPEPOOL               >=5                        0


H. Milton Johnson
Voice: (210) 677-6728
 
-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Prather, Wanda
Sent: Tuesday, August 31, 2004 1:52 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: SQL Select statement help

I hope I'm wrong, but I don't think it's possible to do that.


-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Warren, Matthew (Retail)
Sent: Tuesday, August 31, 2004 10:51 AM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: SQL Select statement help


Hallo ([I]T/AD)SM'ers

Can any wise and clever SQL types help with the following?;

I am trying to get TSM to show the number of tapes that went pending by
date.

I can get this;

ANS8000I Server command: 'select cast(pending_date as char(10)),count(*)
from volumes where status='PENDING' group by pending_date'

Unnamed[1]      Unnamed[2]
----------     -----------
2004-08-27               1
2004-08-27               1
2004-08-27               1
2004-08-28               1
2004-08-28               1
2004-08-28               1
2004-08-28               1
2004-08-28               1
2004-08-29               1
2004-08-29               1


etc..

but what I would like is for the count(*) to be totaling per day. I
hoped perhaps the cast() would force this to happen, but it appears the
underlying timestamp is still being taken into account. I have tried
various other permutations, along the lines of;

ANS8000I Server command: 'select cast(pending_date as char(10)) as
pending,count(*) from volumes where status='PENDING' group by pending'
ANR2940E The reference 'PENDING' is an unknown SQL column name.

                                                                 |
         ........................................................V......
         g,count(*) from volumes where status='PENDING' group by pending


but, alas, no joy.

I'm wondering if it is actually possible? - I know a little Ksh script
that can do it, but I was hoping to achieve it just within TSM - either
with a select as I am trying or via some other method.

Thanks,

Matt.


___________________________ Disclaimer Notice __________________________
This message and any attachments are confidential and should only be
read by those to whom they are addressed. If you are not the intended
recipient, please contact us, delete the message from your computer and
destroy any copies. Any distribution or copying without our prior
permission is prohibited.

Internet communications are not always secure and therefore Powergen
Retail Limited does not accept legal responsibility for this message.
The recipient is responsible for verifying its authenticity before
acting on the contents.
Any views or opinions presented are solely those of the author and do
not necessarily represent those of Powergen Retail Limited.

Registered addresses:

Powergen Retail Limited, Westwood Way, Westwood Business Park, Coventry,
CV4 8LG.
Registered in England and Wales No: 3407430

Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432

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