HELP commands Teradata

The Teradata Database offers several types of help using an interactive client. For convenience, this reduces or eliminates the need to look information up in a hardcopy manual or on a CD-ROM. Therefore, using the help and show operations in this chapter can save you a large amount of time and make you more productive. Since Teradata allows you to organize database objects into a variety of locations, sometimes you need to determine where certain objects are stored and other detail information about them.

HELP commands

To see the database objects stored in a Database or User area, either of the following HELP commands may be used:

HELP DATABASE My_DB ;
Or
HELP USER My_User ;
4 Rows Returned
HELP commands
HELP commands

Since Teradata considers a database and a user to be equivalent, both can store the same types of objects and therefore, the two commands produce similar output.

Now that you have seen the names of the objects in a database or user area, further investigation displays the names and the types of columns contained within the object. For tables and views, use the following commands:

HELP TABLE My_Table ;
7 Rows ReturnedHELP commands

The above outputs display the column name and the kind, which equates to the data type and any comment added to a column. Notice that a view does not know the data type of the columns from a real table. Teradata provides a COMMENT command to add these comments on tables and columns.

The following COMMENT command adds a comment to a table:

COMMENT ON TABLE <table-name> 'This is the new table comment' ;

This COMMENT command adds a comment to a column:

COMMENT ON COLUMN <table-name>.<column-name>
'This is the new column comment' ;

The above column information is helpful for most of the column types, such as INTEGER (I), SMALLINT (I2) and DATE (DA) because the size and the value range is a constant. However, the lengths of the DECIMAL (D) and the character columns (CF, CV) are not shown here. These are the most common of the data types

The next HELP COLUMN command provides more details for all of the columns:

HELP COLUMN My_Table.*
;
6 Rows ReturnedHELP COLUMN command provides
HELP COLUMN command provides more details for all of the columns

The above output has been wrapped to show all the detail information available on the columns of a table.

The next chart shows HELP commands for information on database tables and sessions, as well as SQL and SPL commands:

HELP commands for information on database tables and sessions, as well as SQL and SPL commands

The above chart does a pretty good job of explaining the HELP functions. These functions only provide additional information if the table object has one of these characteristics defined on it. The INDEX, STATISTICS and CONSTRAINT functions will be further discussed in the Data Definition Language Chapter (DDL) because of their relationship to the objects.

At this point in learning SQL, and in the interest of getting to other SQL functions, one of the most useful of these HELP functions is the HELP SESSION.

The following HELP returns information on the session from the PE:

HELP SESSION ;
1 Row Returned (columns wrapped for viewing)HELP returns information on the session from the PE

The above output has been wrapped for easier viewing. Normally, all headings and values are on a single line.

The current date form, time zone and everything that follows them in the output are new with the V2R3 release of Teradata. These columns have been added to make their reference here, easier than digging through the Data Dictionary using SQL.

When using a tool like BTEQ, the line is truncated. So, for easier viewing, the .SIDETITLES and .FOLDLINE commands show the output in a vertical display.

The next sequence of commands can be used within BTEQ:

.sidetitles on
.foldline on
HELP SESSION;
1 Row Returned next sequence of commands can be used within BTEQ
next sequence of commands can be used within BTEQ

To reset the display to the normal line, use either of the following commands:

.DEFAULTS
or
.SIDETITLES OFF
.FOLDLINES OFF

In BTEQ, any command that starts with a dot (.) does not have to end with a semi-colon (;).

The next HELP command returns a list of the available SQL commands and functions:

HELP 'SQL';
41 Rows Returned
On-Line HelpHELP command
helpcommands3

The above output is not a complete list of the commands. The three dots in the center represent the location where commands were omitted so it fit onto a single page. All commands are seen when performed on a terminal.

Once this output has been used to find the command, than the following HELP command provides additional information on it:

HELP 'SQL END TRANSACTION' ;
5 Rows Returned
On-Line Help
{ END TRANSACTION }
{ };
{ET }

Since the terminal is used most of the time to access the database, take advantage of it and use the terminal for your HELP commands.

Tools like Queryman also have a variety of HELP commands and individual menus. Always look for ways to make the task easier.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Teradata Topics