In V6, "SECOND" is always going to return a value between 0 and 60; I don't' think that's what you are after. To get time differences in V6, you need to use the DB2 TIMESTAMPDIFF function. Example:
select timestampdiff(8,cast( (current_timestamp-last_backup_date) as char(22))) as DBHRS from db /* Always cast as char(22); just change the constant 8 to: /* 2 seconds /* 4 minutes /* 8 hours /* 16 days /* 32 weeks /* 64 months /*128 quarters /*256 years -----Original Message----- From: ADSM: Dist Stor Manager [mailto:[email protected]] On Behalf Of Lee, Gary Sent: Thursday, February 16, 2012 10:00 AM To: [email protected] Subject: [ADSM-L] Sql problem tsm v6.22 I've been trying to update an old expiration performance reporting script to run on tsm v6.2.2. I figured out that at the end of each expire run, a summary line is given with an entity of '' However I still get the error below. Anyone out there with any ideas? My db2 admin here is stumped. tsm: TSM01>run expexp ANR0162W Supplemental database diagnostic information: -1:42911:-419 ([IBM][CLI Driver][DB2/LINUXX8664] SQL0419N A decimal divide operation is not valid because the result would have a negative scale. SQLSTATE=42911 ). ANR0516E SQL processing for statement select activity , cast ( ( end_time ) as date ) as "Date" , ( examined/cast ( SECOND ( end_time - start_time) as decimal ( 18 , 13 ) ) *3600 ) "Objects Examined/Hr" from summary where activity = 'EXPIRATION' and entity = '' and days ( end_time ) -days ( start_time ) = 0 failed. ANR1463E RUN: Command script EXPEXP completed in error. ANS8001I Return code 4. Gary Lee Senior System Programmer Ball State University phone: 765-285-1310
