How to Create Flat File
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.


How to Create Flat File Expand / Collapse
Author
Message
Posted 5/4/2006 7:50:36 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 7/17/2006 1:31:00 AM
Posts: 10, Visits: 1
Hi,

Please give inputs to create Flat File in Teradata containing the result set of a query.



Regards
Nits
Post #4108
Posted 5/4/2006 8:48:43 AM
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: 10/12/2006 2:51:00 PM
Posts: 68, Visits: 1
Hi Nits,
you can create a flat file using fastexport utility.

at this file:
.logtable ;

.logon /,

.begin export;

.export outfile mode record format text; /* pay attention, you have to specify both mode record and format text */

select cast(
(
cast(field1 as char(xx))
||cast(field2 as char(xx))
||
)
as char(yy)) /* you have to use this final cast where "yy" is the total lenght of the unique field you obtain linking together the fields you are exporting */

from ....
where ....

;

.end export;
.logoff;


Hope thie helps,
Bye,
TDUser
Post #4109
Posted 5/4/2006 8:49:12 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 7/22/2008 3:48:36 AM
Posts: 173, Visits: 5
You could replicate the logic of the following example bteq script (which outputs the file as a CSV formatted file):


.SET WIDTH 65531;
.LOGON demo/dbc,dbc;

.OS DEL /Q EventLog.txt
.EXPORT DATA FILE=EventLog.txt
.SET INDICDATA OFF

SELECT
Trim(coalesce(cast(DateFld as varchar(32)),''))
||'|'||Trim(coalesce(TimeFld,''))
||'|'||Trim(coalesce(UserName,''))
||'|'||Trim(coalesce(AccountName,''))
||'|'||Trim(coalesce(Event,''))
||'|'||Trim(coalesce(LogicalHostId,''))
||'|'||Trim(coalesce(IFPNo,''))
||'|'||Trim(coalesce(SessionNo,''))
||'|'||Trim(coalesce(cast(LogonDate as varchar(32)),''))
||'|'||Trim(coalesce(LogonTime,''))
||'|'||Trim(coalesce(LogonSource,''))
FROM DBC.EventLog;

.EXPORT RESET

.LOGOFF
.QUIT

Post #4110
Posted 5/5/2006 12:48:56 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 7/17/2006 1:31:00 AM
Posts: 10, Visits: 1
Please tell me where to get FastExport and BTEQ utilities.

These are freewares or come as part of Teradata.

We are currently using Teradata client version.

Regards
Nitin Bajaj


Regards
Nits
Post #4117
Posted 5/5/2006 4:34:51 AM
Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: 10/12/2006 2:51:00 PM
Posts: 68, Visits: 1
Hi,
if you have Teradata RDBMS installed somewhere, on the server you'll find the executable files to run. Usually you find them in Program Files\Ncr\Teradata Client\bin\ directory.

You may execute them directly on the server or using an ETL tool.

Hope this helps,
Bye,
TDUser
Post #4118
« 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 9:21am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.031. 12 queries. Compression Disabled.