Issues with EXPORT OUTPUT DATE FIELD is not coming correctly
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.


Issues with EXPORT OUTPUT DATE FIELD is not... Expand / Collapse
Author
Message
Posted 6/26/2009 5:40:02 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 8/12/2009 3:11:28 AM
Posts: 6, Visits: 24
I have some issues with TD Export command. The SQL I use in export command is

SELECT BUSINESS_UNIT
,' | ',EFFDT
,' | ',EFF_STATUS
FROM ABC

The output of this is spooled to a file called ABC.txt.

$ head ABC.txt
01454 | 06/0 | A |
01731 | 06/0 | A |
G0360 | 06/0 | A |
01700 | 06/0 | A |
01810 | 06/0 | A |
01500 | 06/0 | A |

When I run the query in query man, I get correct data. Result set attached below

01454 | 01/01/2006 | A |
01731 | 01/01/2006 | A |
G0360 | 01/01/2006 | A |
01700 | 01/01/2006 | A |
01500 | 01/01/2006 | A |

Interestingly, when I check DBC.COLUMNS, I find that this date field is has a column width 4.

ColumnName ColumnType ColumnLength
BUSINESS_UNIT CV 5
EFFDT DA 4
EFF_STATUS CV 1


Code Snippet of the BTEQ script as follows

/****************************************************************************************
Set the export file as table name with extension as .txt
****************************************************************************************/
.SET FULLYEAR ON;
.EXPORT DATA FILE=$TABLE_NAME.txt

/****************************************************************************************
Run the select statement in the file created by shell script
****************************************************************************************/

. run file $COL_FILE_NAME
.SET FORMAT OFF;
.EXPORT RESET


Thanks and Regards!

Prajith Varrier
Post #15922
Posted 6/26/2009 5:49:36 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 10/18/2009 5:48:26 AM
Posts: 273, Visits: 1,214
Hello,

Integer-date has a length 4, there is no issue with that. Try by casting it to CHAR/VARCHAR, that should solve the issue.

HTH!

Regards,

Adeel
Post #15923
Posted 6/26/2009 6:28:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 8/12/2009 3:11:28 AM
Posts: 6, Visits: 24
I would not be able to cast it as the SQL is generated dynamically. I thought to cast it to char with length based on column length from the table, but since I see that it is 4, that is also had to to be dropped.

Thanks and Regards!

Prajith Varrier
Post #15924
« 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:56am

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.031. 7 queries. Compression Disabled.