displaying a date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravindranathreddy
    New Member
    • Jul 2007
    • 2

    #1

    displaying a date

    Hi,

    I am trying to select a value from a table which data type is time stamp and in my select query i am checking for the condition, if the retrieved value is null then i am displaying it in the format (0000-00-00-00.00.00.000000 ) for which i am getting error

    Query
    SELECT CASE WHEN MAX(ACTION_TS) IS NULL THEN '0000-00-00-00.00.00.000000 ' ELSE MAX(ACTION_TS) END FROM AUDIT , CARD WHERE ROW_ID = CARD_ACCT_SHORT _NO

    Error
    SQL0181N The string representation of a datetime value is out of range.

    can some one pls help printing out the above value..
  • FritzLeblanc
    New Member
    • Jul 2007
    • 12

    #2
    The problem is that MAX(ACTION_TS) is meaningless. Null doesn not have any meaning so tit can never be max or min, or greateer than, etc.

    You might try the following:
    SELECT CASE COALESCE(ACTION _TS,'0000-00-00-00.00.00.000000 ' FROM AUDIT , CARD WHERE ROW_ID = CARD_ACCT_SHORT _NO

    Comment

    Working...