Loading Date
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.


Loading Date Expand / Collapse
Author
Message
Posted 11/2/2009 11:41:43 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 11/18/2009 10:51:34 AM
Posts: 10, Visits: 36
I getting a records from text file and needs to be loaded into teradata. One of the filed is going to be date. The value i am getting from text file is like this '20091102'. How do I load this into teradata as date field. It should be loaded like '2009/11/02'.?

eg;
What I get
date
-----
20091102

I Should load this to teradata as date value.
Post #17214
Posted 11/2/2009 8:18:59 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/19/2009 9:26:30 PM
Posts: 6, Visits: 11
you can define the column as date format 'yyyymmdd'.
Display will depend on the setting in Queryman.
go to tools--> options-->Genral
and choose the way you want to disply.

for reference you can use below.It worked for me

create volatile table test12
( load_date date format 'yyyymmdd')
on commit preserve rows ;

insert into test12 values ('20091102')

depending on the setting the display will change.
sel * from test12;
11/02/2009
2009-11-02



Rupesh Baheti
Datawarehouse Analyst
OCBC Bank
Singapore
Post #17215
Posted 11/3/2009 3:14:44 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 11/18/2009 10:51:34 AM
Posts: 10, Visits: 36
Hi,

Thanks for your reply. I still have issues.
I created table like this.
CREATE SET TABLE hccloh_ushare.test_date ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
Tst_date DATE FORMAT 'YYYYMMDD')
PRIMARY INDEX ( Tst_date );

Inserted like this.
Insert into hccloh_ushare.test_date values('20091101')
Getting error :3535 A charcter string failed convertion to numeric value.

Tried like this.
Insert into hccloh_ushare.test_date values(20091101)

Then the result is
3909/11/02 which is not correct.

Please advise.
Post #17219
Posted 11/4/2009 2:31:28 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 11/19/2009 7:45:03 AM
Posts: 39, Visits: 169
I have tried to run the same SQL

Insert into hccloh_ushare.test_date values('20091101')

through both SQL Assitent and BTEQ and it is running fine without any error and it inserts date 11/01/2009

Post #17225
Posted 11/4/2009 2:40:38 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/19/2009 9:26:30 PM
Posts: 6, Visits: 11
even I also tried but I have not got any error.
May be you check the session properties by HELP SESSION.
Check the transaction semantics.
Otherwise I do not see any error.
can you paste the output for HELP SESSION ?


Rupesh Baheti
Datawarehouse Analyst
OCBC Bank
Singapore
Post #17226
Posted 11/4/2009 3:34:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/19/2009 9:26:30 PM
Posts: 6, Visits: 11
please change the default dateform to integer date
SET SESSION DATEFORM = INTEGERDATE;
and then run the querries.
At present your settings are in ANSIDATE format
That's why the problem is.
if you can not then you have to change the value as below
while inserting you have to specify in 'yyyy-mm-dd' format and then insert.
create volatile table test12
( load_date date format 'yyyymmdd' )
on commit preserve rows ;

insert into test12 values ('2009-11-02')


Rupesh Baheti
Datawarehouse Analyst
OCBC Bank
Singapore
Post #17227
Posted 11/5/2009 4:45:28 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 11/5/2009 4:40:02 PM
Posts: 717, Visits: 466
Regardless of any DATEFORM setting:


create volatile table test12
( load_date date )
on commit preserve rows ;

insert into test12 values ('20091102' (date ,format 'yyyymmdd'))

Dieter
Post #17265
« 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 1:39am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.141. 8 queries. Compression Disabled.