TITLEDASHES - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.00
Published
November 2016
Language
English (United States)
Last Update
2018-04-25
dita:mapPath
hyz1479325149183.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose

Enables or inhibits a line of dash characters immediately before a report summary line generated by a WITH clause.

If the TITLEDASHES command is used without specifying ON or OFF, BTEQ sets TITLEDASHES to ON ALL.

Syntax



where the following is true:

withlist
A list of numbers from 1 to 10 separated by commas, identify the WITH clauses associated with the TITLEDASHES command.

The number 1 specifies the first WITH clause, 2 specifies the second, and so on.

Specifying 0 instead of a withlist number turns off title dashes for any part of the response that is not summarized by a WITH clause.

Usage Notes

Use the TITLEDASHES command to enhance report appearance by adding a row of dash characters before each specified summary line. Each WITH clause in a Teradata SQL SELECT statement produces a summary line. Use up to nine WITH clauses in a Teradata SQL SELECT statement, and each WITH clause can have up to ten expressions.

To enable a row of dash characters before every summary line in a SELECT result, which is the default configuration, specify .SET TITLEDASHES ON without specifying a withlist number. Also use this command to restore title dashes for summary lines that have been suppressed by a prior command.

To enable or inhibit title dashes for a specific summary line, use the TITLEDASHES command with ON or OFF specified for the appropriate withnumber. Note that if a withnumber is not specified, the statement applies to data that is not summarized by a WITH clause.

Title dashes can also be inhibited for a specific column by using a null title in the SQL statement; for example, TITLE ''. To retain title dashes, use a title comprised of a single space character; for example, TITLE' '.

The TITLEDASHES setting only affects the output for Field Mode, not Record Mode, Indicator Mode, or Multipart Indicator Mode.

The TITLEDASHES command can be used in a Teradata SQL macro.

Example 1 – TITLEDASHES

The following example uses the TITLEDASHES command to suppress dashes preceding the summary line specified by the third WITH clause:

.SET TITLEDASHES OFF 3
.SET FORMAT ON
SELECT deptno, empno, salary, edlev
FROM employee
WITH COUNT(empno) BY deptno
WITH SUM(salary) BY deptno
WITH AVG(edlev) BY deptno;

BTEQ Response

In the BTEQ output, note the lack of dash characters preceding the summary line for the third column:

*** Query completed. 36 rows found. 4 columns returned.
*** Total elapsed time was 4.71 seconds.
    
 95/05/16 SELECT deptno, empno, salary, edlev from employee Page 1
   
DeptNo        EmpNo      Salary  EdLev
------  -----------  ----------  -----
   100        10002   35,000.00     18
   100        10017   32,500.00     16
   100        10001   25,000.00     12
   100        10011   38,000.00     16
        -----------
Count(EmpNo)      4
                     ----------
        Sum(Salary)  130,500.00
   
                 Average(EdLev)     16
   
   300        10018   65,000.00     16
   300        10008   55,000.00     18
   300        10003   23,000.00     16
        -----------
Count(EmpNo)      3
                     ----------
        Sum(Salary)  143,000.00
   
                 Average(EdLev)     17
   
   500        10009   22,000.00     18
   500        10016   44,000.00     20
   500        10010   30,000.00     16
   500        10014   34,000.00     16
   500        10015   40,000.00     16
   500        10004   42,000.00     18
   500        10012   56,000.00     20
        -----------
Count(EmpNo)      7
                     ----------
        Sum(Salary)  268,000.00
   
                 Average(EdLev)     18
   
   600        10007   45,000.00     16
   600        10006   29,000.00     12
   600        10019   28,600.00     12
   600        10013   44,000.00     16
        -----------
Count(EmpNo)      4
                     ----------
        Sum(Salary)  146,600.00
   
                 Average(EdLev)     14
   
   700        10021   45,000.00     16
   700        10020   30,000.00     16
   700        10022   38,000.00     16
        -----------
Count(EmpNo)      3
                      ----------
         Sum(Salary)  113,000.00
   
                 Average(EdLev)     16

Example 2 – TITLEDASHES instigated by a macro

The Example 1 TITLEDASHES command and request in a Teradata SQL macro appear as follows:

ECHO '.SET TITLEDASHES OFF 3';
SELECT deptno, empno, salary, edlev
FROM employee
WITH COUNT(empno) BY deptno
WITH SUM(salary) BY deptno
WITH AVG(edlev) BY deptno;