Advantage of Export-Template is that it eliminates the need to define separate TPT script for each of the table.

TPT Export-Template

TPT Export-Template is a file producer which works similar to Fastexport utility. Advantage of Export-Template is that it eliminates the need to define separate TPT script for each of the table.

There are five data formats in which data can be exported using TPT. Please visit TPT-Export page for detail of each format type.
Points to be noted: Since TPT Export-Template is extension of TPT Export, please visit TPT-Export page to get more detail about export related attributes.
  1. Six basic attributes are mandatory( that are UserName, UserPassword, SelectStmt, Tdpid, FileName and Format) for using TPT Export-Template.
  2. TPT Export-Template eliminate the need of defining 'OPERATOR' separately.
  3. There is no need to define schema as Export-Template generates schema from the query passed as variable.
  4. Careful! always define maximum number of sessions(using MaxSessions) that can be allocated to the job, else it may end up taking all the sessions.

Sample Script: TPT Export-Template script(tpt_export_template.tpt) can be used to export file of any format.
#tpt_export_template.tpt
USING CHARACTER SET @var_utf 
DEFINE JOB tpt_export_template 
(
  APPLY TO OPERATOR ($FILE_WRITER() ATTR (FileName=@var_outfile, Format=@var_format, TextDelimiter=@var_delimiter_value,  DirectoryPath=@var_directorypath))
  SELECT * FROM OPERATOR($EXPORT() ATTR (TdpId=@var_tdpid, UserName=@var_userid, UserPassword=@var_password, SelectStmt=@var_exportquery, MaxSessions=@var_maxsessions, DateForm = @var_dateform, MaxDecimalDigits = 38));
);
Click here to download the above Export-Template script.


Executing Export-Template scripts