467,887 Members | 1,568 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,887 developers. It's quick & easy.

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..
Jul 24 '07 #1
  • viewed: 1414
Share:
1 Reply
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
Jul 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by paul | last post: by
2 posts views Thread by Russ | last post: by
5 posts views Thread by nbohana | last post: by
9 posts views Thread by Bosconian | last post: by
2 posts views Thread by Colleen Robledo, MLIS | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.