Arnaud,

TSM comes with a rich set of SQL functions.  Get a hold of Andy Raibeck's "Using the 
SQL Interface" manual, it is very useful (search the archives to find where it is)

Date functions include

Day  - Day of month
dayname
dayofweek - 1..7 Sunday..Saturday
dayofyear 
daysinmonth
daysinyear
Monthname

I've just been reviewing the manual and there are some neat ones that I'm going to try

coalesce(value,value,value...)   returns the first non-null in the list of values
nullif(expression1,expression2) returns null if the expressions are equal or 
expression1 otherwise
 
Andy, your manual is great, but its a bit out of date.  Any chance of an up to date 
version or even better making it a part of the shipped manual set?

Steve Harris
AIX and TSM Admin
Queensland Health, Brisbane Australia

>>> [EMAIL PROTECTED] 21/10/2002 19:39:12 >>>
Hi *SM'ers,

I'm looking for an SQL command to check the current day of week, before starting the 
conditional excution of a subsequent script. I already found something that seems to 
work, looking like :

Script blah ...
select date_time, message from actlog where cast((current_timestamp-date_time) minutes 
as decimal(8,0)) < 1 and dayname(date_time) = 'Tuesday'
if(rc_ok) goto tuesday
If (rc_notfound) goto restofweek
tuesday : 
run script1
exit
restofweek :
run script2
exit

Unfortunately this kind of select statement take ages to complete, because it has to 
go through all the activity log to find the last lines written, as we keep one month 
of it !
Does anybody have a faster way doing this kind of query/test  ? (without calling an 
AIX script)
Thanks in advance ....
Cheers.

Arnaud

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Arnaud Brion, Panalpina Management Ltd., IT Group     |
| Viaduktstrasse 42, P.O. Box, 4002 Basel - Switzerland |
| Phone: +41 61 226 19 78 / Fax: +41 61 226 17 01       | 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



**********************************************************************
This e-mail, including any attachments sent with it, is confidential 
and for the sole use of the intended recipient(s). This confidentiality 
is not waived or lost if you receive it and you are not the intended 
recipient(s), or if it is transmitted/ received in error.  

Any unauthorised use, alteration, disclosure, distribution or review 
of this e-mail is prohibited.  It may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this 
e-mail in error, you are asked to immediately notify the sender by 
telephone or by return e-mail.  You should also delete this e-mail 
message and destroy any hard copies produced.
**********************************************************************

Reply via email to