Fast export in UNIX using Teradata creating issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fast export in UNIX using Teradata creating issue
# 1  
Old 05-18-2012
Fast export in UNIX using Teradata creating issue

Hi All,

I am trying to export a file using Fast Export (Teradata) in UNIX. The desired output length is 550 bytes, but the output file is creating string till 75 characters. How to get the full length file?
Code:
.LOGON 
.EXPORT file=export.txt;
SELECT CAST(('' ||
(CAST('UD ' AS CHAR(3))) || 
(CAST(B.column1 AS CHAR(2))) ||
:
:
(CAST(B.columnN AS CHAR(6)),''))) AS CHAR(550)) (title '')
FROM Table1;
.EXPORT RESET;
.LOGOFF;

Thanks.

Last edited by joeyg; 05-18-2012 at 03:42 PM.. Reason: Please wrap CodeTags around commands and data.
# 2  
Old 05-18-2012
This is a clip from(forums.teradata.com):
To export into a fixed width flat file run this query:
Code:
SELECT ColumnID, ColumnLength, ColumnType, ColumnName,
CASE
WHEN ColumnType = 'CF' THEN ColumnLength -- char
WHEN ColumnType = 'CV' THEN ColumnLength / 2 --varchar
WHEN ColumnType = 'I' THEN 11 --integer
WHEN ColumnType = 'I1' THEN 4 --byte integer
WHEN ColumnType = 'I2' THEN 6 --small integer
WHEN ColumnType = 'D' THEN 19 --decimal
WHEN ColumnType = 'F' THEN 19 --float
WHEN ColumnType = 'DA' THEN 10 --date
WHEN ColumnType = 'TS' THEN 19 -- timestamp
ELSE NULL
END
AS RealColumnLength
FROM dbc.COLUMNS
WHERE dbc.COLUMNS.tableName = 'YOUR_TABLE'
ORDER BY ColumnID

and then for the fastexport script concatenate "cast (ColumnName as char(RealColumnLength))||" for each column. Cast the resulting string to a sum(RealColumnLength). I am using a simple Excel worksheet for this.


also check out: http://forums.teradata.com
# 3  
Old 05-20-2012
Hi Spacebar,
Thanks for the reply. I am trying to do the same thing (but not ran the query you have mentioned in your answer).
I am casting all the columns with their original length and then casting all the columns as the total length of the output file (550 byte). But, still it is not coming as desired.
Its urgent and I am not able to do it.Looking for help from all of you guys. thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Minute(4) issue in teradata

I have values below for which diff field is giving error like "invalid time interval" in teradata Might be it is not doing calculation anymore after exceeding minute(4) value END_TS 2/2/2018 08:50:49.000000 START_TS 1/5/2018 17:30:02.000000 SLA_TIME 23:59:59.000000 select... (0 Replies)
Discussion started by: himanshupant
0 Replies

2. Shell Programming and Scripting

Svn export issue

Hi all, When i do "svn export <URL of the specific file in svn>" it gives me file which is of older version instead of a file which is of latest or current working version. On the other hand, "svn co <URL of the directory in svn>" It gives me latest version committed files and... (0 Replies)
Discussion started by: nnsjw702
0 Replies

3. Shell Programming and Scripting

Teradata connectivity through UNIX by use bteq

Hi, I want a script for connecting teradata to load the file to teradata table. Can you please help me out. Thanks in advance. (1 Reply)
Discussion started by: victory
1 Replies

4. UNIX for Dummies Questions & Answers

export in unix

hi i have some lines in a text file like, export ORACLE_HOME=/home/dell/instantclient_11_2 export LD_LIBRARY_PATH=$ORACLE_HOME:${LD_LIBRARY_PATH} export PATH=$ORACLE_HOME:$ORACLE_HOME/sdk:${PATH} how to run this file such that every line will be exported in unix session (3 Replies)
Discussion started by: mprakasheee
3 Replies

5. OS X (Apple)

Creating a file to export into Excel

Hello, This is my first post so not sure what response I will get I do have a very small knowledge of UNIX used last over 10 years ago I have recently move over to an Apple IMAC I need to copy all my jpg files into excel Could someone please let me know if this is possible and... (2 Replies)
Discussion started by: Nacnud
2 Replies

6. UNIX for Dummies Questions & Answers

Fast export in unix

/opt/teradata/client/bin/fexp <<EOP .LOGTABLE load_work.datastore_log1 ; .LOGON BOX/userid,password; .BEGIN EXPORT SESSIONS 20; .EXPORT OUTFILE $path MODE RECORD FORMAT TEXT; select trim(cast(PROC_YYMM_DT as char(5))) (title ''), cast('~' as char(1)), trim(cast(ACCNO as char(21)))... (1 Reply)
Discussion started by: depakjan
1 Replies

7. Programming

Unix - teradata

I am trying execute a sql file from the script and the sql file has the following code snippet, which throws out the error given below FOR C_FINELINE_LP AS CURSOR C_SLS FOR SELECT * FROM WM_UTIL.FLT_DEP WHERE LOAD_IND = 'N' DO ..... ..... .... END FOR; FOR C_FLTSLS_STR_LP AS... (0 Replies)
Discussion started by: yschd
0 Replies

8. UNIX for Advanced & Expert Users

A Fast File System For Unix

We have an assignment to critique Mckusic'sk paper A Fast File System for Unix http://www.cs.berkeley.edu/~brewer/cs262/FFS.pdf. As a part of the paper we are supposed to regenerate the values found in Table 1 and Table 2a and 2b using linux. My problem is how should I regenerate these results... (2 Replies)
Discussion started by: sigismo
2 Replies

9. Shell Programming and Scripting

export issue

hi, I have a password file called mypwd.bash in /home/oracle/practice directory as follows. mypwd.bash mypwd=oracle export mypwd i called the above file in the following script as follows. passwdtest.bash /home/oracle/practice/mypwd.bash echo $mypwd but nothing is getting ... (2 Replies)
Discussion started by: ravi raj kumar
2 Replies
Login or Register to Ask a Question