Purpose
This control enables users to specify whether titles are to be positioned above or to the left side of data returned for SQL statements. By default, a column title appears above its column and a WITH clause summary title appears to the left side of the data it describes.
Syntax
where the following is true:
- withlist
- A list of numbers, from 1 to 10, separated by commas, that identify the WITH clauses associated with the SIDETITLES command.
The number 1 specifies the first WITH clause, 2 specifies the second, and so on.
If 0 is specified instead of a withlist number, side titles are turned off for any part of the response that is not summarized by a WITH clause.
Usage Notes
By default, SIDETITLES is OFF for result column headings and ON for summary titles that are specified using the Teradata SQL WITH clause. Thus, a column title appears above its column and a WITH clause summary title appears to the left side of the data it describes
.SET SIDETITLES ON overrides these defaults and positions all column headings to the left of their columns.
Typically, .SET SIDETITLES ON is used in conjunction with the FOLDLINE command. By setting the FOLDLINE command options to ON ALL and setting the SIDETITLES command option to ON, each field can be presented on its own line with its title to the left. This technique can be useful for long fields that do not fit the report in any other format.
If a WITH clause is used to subtotal the first column of a result, a summary title appearing to the left of the result is lost. The summary title can be retained by using .SET SIDETITLES OFF 1 to place it above the summary result.
If the SIDETITLES command is used without choosing ON or OFF, BTEQ sets SIDETITLES to ON for column titles only.
The SIDETITLES setting only affects the output for Field Mode, not Record Mode, Indicator Mode, or Multipart Indicator Mode.
The SIDETITLES command can be used in a Teradata SQL macro.
Example 1 – SIDETITLES
The following example shows how the SIDETITLES command affects the output:
database workforce; .defaults .format on .heading 'Sidetitles On' .sidetitles on .set suppress on 1 select name ,deptno ,salary from employee with sum(salary)(title 'sum of salary') by deptno; .defaults .heading 'Sidetitles Off' .sidetitles off =1 .format off .logoff .exit
BTEQ Response
*** Query completed . 26 rows found. 3 columns returned. Sidetitles On Name Peterson J DeptNo 100 Salary 25,000 .00 Name Chin M DeptNo 100 Salary 38,000 .00 Name Greene W DeptNo 100 Salary 32,500 .00 Name Moffit H DeptNo 100 Salary 35,000 .00 ---------- sum of salary 130,000 .00 Name Phan A DeptNo 300 Salary 55,000 .00 Name Russell S DeptNo 300 Salary 65,000 .00 Name Leidner P DeptNo 300 Salary 23,000 .00 ----------- sum of salary 143.000.00 Name Inglis C DeptNo 500 Salary 34,000 .00 Name Carter J DeptNo 500 Salary 44,000 .00 Name Watson L DeptNo 500 Salary 56,000 .00 Name Smith T DeptNo 500 Salary 42,000 .00 Name Omura H DeptNo 500 Salary 40,000 .00 Name Reed C DeptNo 500 Salary 30,000 .00 Name Marston A DeptNo 500 Salary 22,000 .00 ----------- sum of salary 268,000. 00 Name Kemper R DeptNo 600 Salary 29,000 .00 Name Newman P DeptNo 600 Salary 28,600 .00 Name Aguilar J DeptNo 600 Salary 45,000 .00 Name Regan R DeptNo 600 Salary 44,000 .00 ----------- sum of salary 146,000 .00 Name Smith T DeptNo 700 Salary 45,000 .00 Name Clements D DeptNo 700 Salary 38,000 .00 Name Brangle B DeptNo 700 Salary 30,000 .00 ----------- sum of salary 113,000 .00 *** Query completed. 26 rows found. 3 columns returned. Sidetitles Off Name DeptNo Salary ------------ ------ ---------- Peterson J 100 25,000 .00 Chin M 100 38,000 .00 Greene W 100 32,500 .00 Moffit H 100 35,000 .00 ---------- sum of salary 130,500 .00 Phan A 300 55,000 .00 Russell S 300 65,000 .00 Leidner P 300 23,000 .00 ---------- sum of salary 143,000 .00 Inglis C 500 34,000 .00 Carter J 500 44,000 .00 Watson L 500 56,000 .00 Smith T 500 42,000 .00 Omura H 500 40,000 .00 Reed C 500 30,000 .00 Marston A 500 22,000 .00 ---------- sum of salary 268,000 .00 Kemper R 600 29,000 .00 Newman P 600 28,600 .00 Name Aguilar J DeptNo 600 Salary 45,000 .00 Name Regan R DeptNo 600 Salary 44,000 .00 ----------- sum of salary 146,000 .00 Name Smith T DeptNo 700 Salary 45,000 .00 Name Clements D DeptNo 700 Salary 38,000 .00 Name Brangle B DeptNo 700 Salary 30,000 .00 ----------- sum of salary 113,000 .00
Example 2 – SIDETITLES
To display fields on separate lines, with titles printed to the left, type:
.SET FOLDLINE ON ALL .SET SIDETITLES ON
Example 3 – SIDETITLES instigated by a macro
The Example 2 FOLDLINE and SIDETITLES commands in a Teradata SQL macro appear as:
ECHO '.SET FOLDLINE ON ALL'; ECHO '.SET SIDETITLES ON';