Integer to date conversion - Error
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Integer to date conversion - Error Expand / Collapse
Author
Message
Posted 10/29/2007 7:14:38 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/29/2007 7:06:25 PM
Posts: 2, Visits: 2
Here is the query i am trying to run :

select cast(cast(cast(cal.cal_id as integer format '9999999999') as varchar(10) ) as timestamp(0) format 'YYYYMMDDHH') from miesa01.calen cal

Here cal_id is an integer column.. i have tried all the variations for this .. the strange part is the following query works perfectly fine

select cast(cast(cast(2007090909 as integer format '9999999999') as varchar(10) ) as timestamp(0) format 'YYYYMMDDHH') from miesa01.D_CAL_CALENDAR cal

Please try to pur your ideas and experience.


Thanks,
Laxmi
Post #9495
Posted 10/30/2007 5:39:47 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 6/25/2008 7:26:06 AM
Posts: 474, Visits: 202
Hi Laxmi,
providing the actual error is more helpful than just "doesn't work".

And why do you cast cal_id to an integer if it's already an integer?

Dieter
Post #9512
Posted 11/9/2007 11:48:12 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 5/29/2008 1:27:36 PM
Posts: 43, Visits: 48
Laxmi,

Maybe the following structure helps you:

create table test (id INTEGER);

INSERT TEST VALUES (2007090909);
INSERT TEST VALUES (2007110914);


SELECT CAST((CAST (ID AS CHAR(10))) AS TIMESTAMP FORMAT 'YYYYMMDDHH')
FROM TEST;

Good luck!
Post #9673
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 2:37pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 8 queries. Compression Disabled.