Teradata BTEQ utility export in report format(In record mode)

Problem:Teradata BTEQ utility export in report format(In record mode)

write a script file
hyperjcop1:~/samplepro # vi  expscr1.btq
**(writing a script file)

.logon dbc/dbc,dbc;

.export  report  file = /root/samplepro/dbctablesexp.txt

.set retlimit *
 select * from dbc.tables;

.export reset;
--------------------------------------------------
run the script file ecpscr.btq

 BTEQ -- Enter your SQL request or BTEQ command:
.run file = /root/samplepro/expscr1.btq
---------------------------------------
Once the output gets completed
go to
hyperjcop1:~/samplepro #       cat dbctablesexp.txt ( to see the output)

----x-xxxx-xxxxxxx----------------
cli>vi  expscr2.btq

.logon dbc/dbc,dbc; 
database db_dec;

.export  report  file = /root/samplepro/sampleexport.txt
.set retlimit 8

select * from eztest
union all
select * from sampletable2;

.export reset;
--------------------------------------------------
Hint:

.set retlimit will set the limit for the number of record count to return for the  select statement executed in the script.
In bteq utility execute statement show controls to see the session controls set for the utility.Unless you change it according to your requirement , these settings applies to any statement executed.

b)once in any script if any changes has been made to controls those will be applied to successive execution statement result too.

Note: The report format (record mode) will print the results in rows with row headings and fields seperated by  tab.

see sample result

DatabaseName                   TableName                           Version TableKind ProtectionType JournalFlag CreatorName
------------------------------ ------------------------------ ------------ --------- -------------- ----------- --------------------
SYSUDTLIB                      INTPRDTIMETYPE_CONSTR1                    1 H         F              N           DBC
DBC                            ProfileInfoX                              1 V         F              NN          DBC
SYSUDTLIB                      ST_Geometry_Constructor6                  1 H         F              N           DBC
DBC                            SessionInfoVX                             1 V         F              NN          DBC
tdwm                           TDWMResPsWDJoinByNode                     1 M         F              NN          DBC
DBC                            TriggersTbl_TD12                          1 T         F              NN          DBC
TD_SYSFNLIB                    CEILINGBIGINT                             1 F         N              N           DBC
DBC                            FunctionsX                                1 V         F              NN          DBC

 

IMPORT MODES :  INDICDATA, DATA, VARTEXT
OUTPUT MODES : DATA, INDICDATA ,REPORT , DIF

No comments:

Post a Comment