Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Combine Date field and Time field together as TimeStamp field
Mon, May 11 2015 11:58 PMPermanent Link

Adam H.

Hi,

I have a situation where I have data in two seperate fields, one as a
date field, and the other as a time field.

I would like to create a query which combines both of these with a
result in a TimeStamp field, but have been struggling with this:

I have tried the following, all without success:

Select DateField + TimeField
Select Cast(DateField as TimeStamp) + TimeField
Select Cast(DateField as TimeStamp) + Cast(TimeField as TimeStamp)

Does anyone know of a way in DBISam to combine date and time fields
together using SQL?

Thanks & Regards

Adam.
Tue, May 12 2015 2:38 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


From creaking memory I think you have to form the Timestamp before casting it so untested


CAST(CAST datefield AS VARCHAR(10))+' '+CAST(timefield as VARCHAR(10)) AS TIMESTAMP)


Roy Lambert
Tue, May 12 2015 3:21 AMPermanent Link

Adam H.

Hi Roy,

>  From creaking memory I think you have to form the Timestamp before casting it so untested
>
>
> CAST(CAST datefield AS VARCHAR(10))+' '+CAST(timefield as VARCHAR(10)) AS TIMESTAMP)

Yup - that appears to be what I need to do. Thanks very much for your help!

Cheers

Adam.
Image