By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,514 Members | 1,693 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,514 IT Pros & Developers. It's quick & easy.

displaying a date

P: 2
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
Share this Question
Share on Google+
1 Reply


P: 12
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.