SHOW - Basic Teradata Query - 16.20

Basic Teradata Query Reference

prodname
Basic Teradata Query
vrm_release
16.20
category
Programming Reference
featnum
B035-2414-108K

Purpose

Prints the last SQL request sent to the database to the standard output stream.

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: