Pkr
Pkr

Reputation: 31

Need help in teradata

In one of the tables I've a time column where the data is something like this : 01:21:00.000000 for all the records.

I want to retrieve the data which looks like below.

01:21:00 in teradata.

Please advise. I'm new to teradata and don't know how to achieve this

Upvotes: 0

Views: 75

Answers (2)

Nimisha
Nimisha

Reputation: 80

If your column is timestamp, then we can use Timestamp(0) is YYYY-MM-DDbHH:MI:SS and Timestamp(6) is YYYY-MM-DDbHH:MI:SS.ssssss (milliseconds extra).

If your column is just time, then we can use 'CAST'.

select cast( as time(0)) from ;

Upvotes: 0

Andrew
Andrew

Reputation: 8693

I don't know a reasonable way to go to less precision in time (or timetamps) in Teradata. Assuming your column is time(6), you can't just cast that to time(0). You get a DateTime field overflow error.

I do it by casting it to a character field and then back to time(0):

select *
from
<your table>
where
cast(cast <your column> as varchar(8)) as time(0) = '01:21:00'

Upvotes: 1

Related Questions