Convert character to date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iffizin
    New Member
    • Jun 2008
    • 1

    Convert character to date

    how to convert character to date. writetime is character data type.
    i want to have CPU utilization of last 24 hrs. for time being i want to have result from 1 server.


    select "AVG_%_Total_Pr ocessor_Time", "WRITETIME" , "MAX_%_Total_Pr ocessor_Time", "MIN_%_Total_Pr ocessor_Time", "AVG_%_Total_Pr ivileged_Time" , "AVG_%_Total_Us er_Time", "AVG_Context_Sw itches/Sec", "AVG_Total_Inte rrupts/Sec"
    from "NT_System_ HV"

    where "Server_Nam e" = 'Primary:ITM6VM :NT' and "WRITETIME" between '00000000000000 00' and'99999999999 99999'

    query working fine till where server name but i am confuse how to utilize and get result from between clause and get last 24 hrs result.



    i want this query for BIRT report design and itm6.2.
  • docdiesel
    Recognized Expert Contributor
    • Aug 2007
    • 297

    #2
    Hi,

    if you can't change the WRITETIME column to integer, then try to add a generated column which automatically gets set as converted integer value of WRITETIME:

    Code:
    alter table NT_System_HV
      add column  WRITETIME_INT
      GENERATED ALWAYS AS ( int(WRITETIME) )  ;
    and modify your SELECT statement:

    Code:
    ... and "WRITETIME_INT"
      between 0 and 9999999999999999
    Regards,

    Bernd

    Comment

    • niladri123
      New Member
      • Dec 2007
      • 8

      #3
      select date(19-1-08) from sysibm.sysdummy 1

      Comment

      Working...