SHOW - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-06-28
dita:mapPath
wmy1488824663431.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose

Displays the last SQL request sent to database.

Syntax



Usage Notes

Use the .SHOW command to display the last SQL request that was sent to database. The .SHOW command can be used even if ECHOREQ is set to OFF.

You can use the SHOW command in a Teradata SQL macro. However, note that if a "ECHO '.SHOW';" SQL is used in a macro, that actually becomes the “last” SQL request, in which case, the SHOW command would always return "ECHO '.SHOW';" itself.

The only way to get the last SQL request using SHOW command in a macro is to use the "ECHO'.SHOW';" SQL in a multi-statement request.

Example – SHOW

BTEQ -- Enter your SQL request or BTEQ command:
SELECT date;

*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

    Date
--------
12/02/20

BTEQ -- Enter your SQL request or BTEQ command:
ECHO '.SHOW';

*** Echo accepted.
*** Total elapsed time was 1 second.

ECHO '.SHOW';

BTEQ -- Enter your SQL request or BTEQ command:
SELECT date
; ECHO '.SHOW';

*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

    Date
--------
12/02/20

*** Echo accepted.

SELECT date
; ECHO '.SHOW';

BTEQ -- Enter your SQL request or BTEQ command:
.SET ECHOREQ ERRORONLY

.SET ECHOREQ ERRORONLY
BTEQ -- Enter your SQL request or BTEQ command:
SELECT junk
; ECHO '.SHOW';

*** Failure 3822 Cannot resolve column 'junk'. Specify table or view.
               Statement# 1, Info =0

*** Request Text:
SELECT junk
; ECHO '.SHOW';

*** Total elapsed time was 1 second.

BTEQ -- Enter your SQL request or BTEQ command: