Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Intervals
Mon, Jan 14 2008 5:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Can anyone convert this to ElevateDB

(IF(_LastAccess IS NOT NULL THEN CURRENT_TIMESTAMP - _LastAccess ELSE 99999.99))  AS _LongAgo,


Roy Lambert

ps

Were intervals invented by the same moron who decided that null <> empty string?
Mon, Jan 14 2008 5:36 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Forgot to sat _LastAttempt is a DateTime field

Roy Lambert
Mon, Jan 14 2008 5:46 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Made it eventually


(IF(_LastAccess IS NOT NULL
THEN CAST(CAST(CURRENT_TIMESTAMP - _LastAccess AS INTERVAL DAY) AS INTEGER)
ELSE 99999))  AS _LongAgo,

A couple of points for anyone else trying this - DON'T use CURRENT_DATE and CURRENT_TIMESTAMP with the wrong field type - these days you get an error.

Personally I don't think you should but you do.

Roy Lambert
Mon, Jan 14 2008 7:26 AMPermanent Link

"Ole Willy Tuv"
Roy,

<< CAST(CAST(CURRENT_TIMESTAMP - _LastAccess AS INTERVAL DAY) AS INTEGER) >>

You don't need to explicitly cast the expression, since the result of
datetime arithmetic is an interval. You just need to specify the type of
interval you want:

CAST((CURRENT_TIMESTAMP - _LastAccess) DAY AS INTEGER)

Ole Willy Tuv
Mon, Jan 14 2008 7:58 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ole


Thanks - that works well.

Roy Lambert
Image