Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Teradata timestamp format

Status
Not open for further replies.

rrrkrishnan

Programmer
Jan 9, 2003
107
US
Hi

In Teradata is it possible to load a timestamp literal which is in the format 'mm/dd/yyyy hh:mm:ss' into a timestamp column.

Please let me know.

Thanks
Krishnan

 
In V2R5 they added format strings for Timestamp, so this is easy:

select '01/09/2003 22:18:10'
(timestamp(0), format 'mm/dd/yyyyBhh:mi:ss') as y;

*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

y
-------------------
01/09/2003 22:18:10


As you probably don't run V2R5, it's some nasty subtrings:
select '01/09/2003 22:18:10' as x,
substring(x from 7 for 4) || '-' ||
substring(x from 1 for 2) || '-' ||
substring(x from 4 for 2) || ' ' ||
substring(x from 12) (timestamp(0)) as y;

*** Query completed. One row found. 2 columns returned.
*** Total elapsed time was 1 second.

x y
------------------- -------------------
01/09/2003 22:18:10 2003-01-09 22:18:10

Dieter
 
Thats good to know, we are indeed using V2R4.

Thanks a lot
Krishnan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top