Hi: I am just learning how to use the Select SQL and am encountering
some problems. I do plan to purchase one or more of the references
Andy recommended in September but I have been making do with IBM
Database 2 Version 3 DB2 SQL Reference first edition December 1993.
I want to produce a list of nodes with filespaces that have not been
backed up in over 30 days.
select node_name,filespace_name,backup_end,current_date-date(backup_end)
from filespaces where (current_date-date(backup_end)>(30 days))
NODE_NAME FILESPACE_NAME BACKUP_END Unnamed[4]
------------------ ------------------ ------------------ ----------
ANGBAND ANGBAND\SYS: 1998-11-09 0
ANGBAND ANGBAND\SYS: 1998-11-09 0
04:04:00.000000
ANGBAND ANGBAND\VOL1: 1998-11-09 0
04:01:10.000000
ANGBAND ANGBAND\VOL2: 1998-11-09 0
04:04:01.000000
ATHLETICS ATHLETICS\NDS: 1998-07-02 130
16:17:32.000000
BIC-NTS Lazimy 1998-11-09 0
00:07:37.000000
BIC-NTS SOB-LIBRARY 1998-11-09 0
00:01:22.000000
BIC-NTS SYSTEM 1998-11-09 0
00:02:18.000000
BIC-NTS VOL1 1998-11-09 0
00:04:13.000000
1) Why are the zero date intervals passing the test? Please note
that running the query with no "where" shows that the filespaces
backed up yesterday are being excluded from the output:
select
node_name,filespace_name,backup_end,current_date-date(backup_end) from
filespaces
NODE_NAME FILESPACE_NAME BACKUP_END Unnamed[4]
------------------ ------------------ ------------------ ----------
ANGBAND ANGBAND\BINDERY:
ANGBAND ANGBAND\BINDERY:
ANGBAND ANGBAND\SYS: 1998-11-09 0
04:04:00.000000
ANGBAND ANGBAND\VOL1: 1998-11-09 0
04:01:10.000000
ANGBAND ANGBAND\VOL2: 1998-11-09 0
04:04:01.000000
ASM-SERVER ASMFAT 1998-11-08 1
21:33:58.000000
ASM-SERVER ASMFAT2 1998-11-08 1
21:41:19.000000
ASM-SERVER ASMNTFS 1998-11-08 1
21:41:01.000000
ATHLETICS ATHLETICS\DISK01: 1998-11-08 1
22:06:22.000000
ATHLETICS ATHLETICS\DISK03: 1998-11-08 1
22:10:54.000000
ATHLETICS ATHLETICS\NDS: 1998-07-02 130
16:17:32.000000
The following query should/could exclude the zero day interval records but it
instead excludes all records:
adsm> select node_name,filespace_name,backup_end,current_date-date(backup_end)
from filespaces where (current_date-date(backup_end)>(30 days))and(curren
t_date-date(backup_end)<>0 days)
ANR2034E SELECT: No match found using this criteria.
ANS8001I Return code 11.
2) select
node_name,filespace_name,backup_end,current_date-date(backup_end) from
filespaces where (current_date-date(backup_end) > (30 days))
causes my output to be redirected to a filename "(30" and there the
message says there is a missing SL token. This puzzles me because I
thought redirection was specified on the command line when the client
is first loaded. eliminating the spaces seems to correct the problem
but I doubt the SQL standard requires no spaces . . .
3) The paste function in the dsmadmc DOS window operates strangely.
The first time I try to paste the expression the paste button stays
down and nothing happens. Then I hit the Esc key and retry the paste
and it does work. Very consistently requires that Esc-retry step.
Many thanks in advance.
Eric Lewis UW-Madison
eric.lewis AT doit.wisc DOT edu
|