Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread CAST error
Thu, Apr 12 2007 2:17 PMPermanent Link

"Ole Willy Tuv"
Executing the following query in EDB Manager:

select
 cast(current_time as timestamp)
from dummy

Error:
'0.66348709' is not a valid timestamp.

I'm not able to close the error dialog, it keeps popping up, and I need to
kill the application in the task manager.

The following expression:

cast(cast(current_time as timestamp) as varchar(24))

executes fine and returns a timestamp string with a correct time part, but
with the date part incorrectly set to 0000-00-00. To my knowledge, a cast
from DATE to TMESTAMP should set the date part to the current date and the
time part to the source value.

Ole Willy Tuv

Thu, Apr 12 2007 3:38 PMPermanent Link

"Ole Willy Tuv"
<< To my knowledge, a cast from DATE to TMESTAMP should set the date part to
the current date and the time part to the source value. >>

TMESTAMP is a short hand for TIMESTAMP Smile

Ole Willy Tuv

Thu, Apr 12 2007 4:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< Executing the following query in EDB Manager:

select
 cast(current_time as timestamp)
from dummy

Error:
'0.66348709' is not a valid timestamp.

I'm not able to close the error dialog, it keeps popping up, and I need to
kill the application in the task manager.>>

It's that silly Delphi 6 and higher issue with having a zero date value in a
TTimeStamp structure.  I'll see what I can do about working around it.

<< The following expression:

cast(cast(current_time as timestamp) as varchar(24))

executes fine and returns a timestamp string with a correct time part, but
with the date part incorrectly set to 0000-00-00. To my knowledge, a cast
from DATE to TMESTAMP should set the date part to the current date and the
time part to the source value. >>

Frankly, I have no idea, but what you suggest sounds fine to me.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 12 2007 4:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< TMESTAMP is a short hand for TIMESTAMP Smile>>

I also assumed that DATE to TIMESTAMP was short-hand for TIME to TIMESTAMP.
Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 12 2007 4:22 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< Frankly, I have no idea, but what you suggest sounds fine to me. >>

Good, since it's both the SQL specifaction (ref. 6.12 <cast specification>)
and the common industry behavior.

It also makes sense, since a TIMESTAMP with a date part of 0000-00-00 is an
invalid TIMESTAMP value, as opposed to the current date which makes the
TIMESTAMP a valid value.

Ole Willy Tuv

Thu, Apr 12 2007 5:42 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< I also assumed that DATE to TIMESTAMP was short-hand for TIME to
TIMESTAMP. >>

hm.. fuzzy short-hand, yes Smile

Ole Willy Tuv

Thu, Apr 12 2007 7:00 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< It's that silly Delphi 6 and higher issue with having a zero date value
in a TTimeStamp structure.  I'll see what I can do about working around it.
>>

Thinking about it - I guess that you don't have to work around it if you set
the correct value, i.e. the current date instead of 0, when evaluating this
expression.

The basic problem is the invalid 0 date, I'd guess.

Ole Willy Tuv

Sat, Apr 14 2007 3:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< The basic problem is the invalid 0 date, I'd guess. >>

Yep.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image