All Forums UDA
Nits 10 posts Joined 05/06
04 May 2006
How to Create Flat File

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

TDUser-781 35 posts Joined 12/04
04 May 2006

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

DGiabbai 47 posts Joined 07/04
04 May 2006

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 OFFSELECT 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

Nits 10 posts Joined 05/06
05 May 2006

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.RegardsNitin Bajaj

TDUser-781 35 posts Joined 12/04
05 May 2006

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

You must sign in to leave a comment.