Documente Academic
Documente Profesional
Documente Cultură
Note: All the commands start with. [SET] and terminated by a semi colon.
For format purpose they are not included in every command in this
document. BTEQ (‘bee-teek’) is short form of Basic Teradata Query. BTEQ
commands (total 55) are categorized as session control, file control, sequential
control and format control commands
=
Example: = 5 (repeats the previous SQL command for 5 times. Default value is 1.)
Cannot be used in SQL macro.
COMPILE – creates or replaces a procedure object in the database using a SPL input
file.
Example: Compile file = ‘testprocedure.spl’ with spl;
Compile command must be the last command in the open transaction.
DEFAULTS – Resets BTEQ commands to defaults those were set when BTEQ first
invoked.
Example: DEFAULTS
ERROROUT – Routes the standard output stream and output stream to a specified
file or device. It works differently for channel-attached system and network attached
system.
Example: ERROROUT STDERR OR STDOUT
EXIT – Log off all the Teradata sessions and exit BTEQ.
Example: EXIT
You cannot use EXIT command in Teradata macro.
EXPORT – Export command export the response of the SQL request in to a specified
file.
Example: EXPORT DATA FILE = ‘EXPORT.DAT’.
If the response is more than 2GB use AXSMODE.
FOLDLINE – Splits a line in to two or more lines after the specified columns. The
maximum number of column is 2048.
Example: FOLDLINE ON 2 4 (splits line after 2nd and 4th column.)
FOOTING – Footing specifies footer notes on the bottom of every page of a report. It
can be used in a SQL macro. The maximum number of characters including a
carriage control is 254, to describe up to 10 lines.
Example: FOOTING ‘&DATE || TEST FOOTING RESULTS || Page&PAGE’
FORMAT – Formats the results of a SQL statement. Default value is OFF.
Example: FORMAT ON | OFF
FULLYEAR – Date is displayed in four-digit year format. It affects only footer, header
and title line.
Example: FULLYEAR ON
GOTO – Skip over all intervening BTEQ commands and SQL commands until a
specified label is encountered then resumes processing.
Example: GOTO <label name>
HEADING
Specifies a header at the top of each page of the report
Example: HEADING ‘THIS IS A HEADING’
LABEL – Identifies a point where BTEQ resumes process, as stated in previous GOTO
statement.
Example: LABEL <label name>
MESSAGEOUT – Specifies a output file for BTEQ to send messages that would
normally be sent to standard output.
Example: MESSAGEOUT FILE=out.log
QUIT – Logs off Teradata session and exist from BTEQ. If Teradata session is already
logged off then just exists from BTEQ.
Example: QUIT
RECORDMODE – Returns data from SQL statement in a client oriented data format
rather than character format.
Example: RECORDMODE ON
REPEAT – Submits the next SQL statement for the specified number of times.
Example: REPEAT 5 (Executes the subsequent SQL statement for 5 times.)
REPEATSTOP – BTEQ stops the entire REPEAT execution of a non-retry table error
occurs.
Example: REPEATSTOP ON
RETRY – Resubmits requests that fail under certain operational error conditions.
Example: RETRY ON
RTITLE – Specifies a title that appears at the top of each page in the report.
Example: RTITLE ‘Report’s title’
RUN – Process Teradata SQL requests and BTEQ commands from a specified file.
Example: RUN FILE=logon.txt
SEPARATOR – Specifies the width and contents of the string to be placed between
the columns in a report.
Example: SEPARATOR ‘ ITEM’S VALUE’, SEPARATOR ‘|’
SHOW ERRORMAP – Displays the contents of the table that maps error code to
severity levels.
Example: SHOW ERRORMAP ON
. SET ERRORLEVEL 4155 SEVERITY 12
SIDETITLES – Positions titles of summary lines on the left side of the data returned
by SELECT statement that included one or more WITH clause.
Example: SIDETITLES ON n| OFF
SKIPDOULES – Inserts two blank lines in the report whenever the value of specified
column changes.
Example: SKIPDOUBLE ON n | OFF
SKIPLINE – Inserts a blank line in the report whenever the value of the specified
column changes.
Example: SKIPLINE ON n | OFF
SUPPRESS – Replaces all consecutive values in the report with blank characters.
Example: SUPPRESS ON | OFF
TDP – Sets the Teradata Director Program as a default tdpid for subsequent log on in
the current session.
Example: TDP DemoTdat
UNDERLINE – Inserts a dashed line across the entire width of the report whenever
the value of the specified column changes.
Example: UNDERLINE ON n | OFF