Teradata SQL Character Strings and Client Physical Bytes | Teradata Vantage - Teradata SQL Character Strings and Client Physical Bytes - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantage™

The server character sets LATIN, UNICODE, and GRAPHIC are declared within Teradata SQL as strings of characters.

Within a client environment, those character data types are expected to be specified as strings of physical bytes rather than as characters.

For example, within client application programs, space is allocated in terms of bytes, the layout of the import files for data loading utilities is expressed in terms of bytes, and so on.

To provide a reasonable bridge between characters in SQL declarations and physical bytes in client environments, clients can specify character strings in bytes even though the destination columns are declared as characters.

Whenever a client is informed about the length of the character expression (as in the HELP COLUMN statement, response parcels, and so on), Teradata Database specifies the length in terms of physical bytes.

General Rules for Server Character Set Declarations

The rules for declaring data types are as follows:
  • The length of a character type is declared in terms of bytes or characters, depending on the server character set.
    IF a character type uses this server character set … THEN the type is defined in terms of …
    • LATIN
    • UNICODE
    • GRAPHIC
    characters
    • KANJI1
    • KANJISJIS
    bytes
  • The length of the imported CHARACTER data described by a USING clause is in terms of bytes (the CHARACTER data description in the USING clause is in bytes). For more information, see “USING Request Modifier” in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.
  • The definition of the character data in response and request parcels is in terms of bytes.
  • Client Load (Teradata FastLoad and Teradata MultiLoad) and Export (Teradata FastExport) utilities use the MultiLoad and FastExport DEFINE or LAYOUT command to specify the layout of the file on the client.

    The layout of CHARACTER data within the DEFINE command is in terms of bytes.

    The layout of GRAPHIC data within the DEFINE command is in terms of characters. This layout is then translated into the response parcel or the USING clause for communication with Teradata SQL. For more information, see “USING Request Modifier” in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146.

Exported Character Data

Export width determines the appropriate number of characters or bytes to export for a client application. System-wide and user-defined export width tables define the export width of characters or bytes during export to a client. The values used for the export width are based on the active export width table, and the server character set and client character set used by the application.

At the system level, the value of the Export Width Table ID field in the DBS Control Record identifies which export width table to use to determine export widths.

The following table lists the system export width tables provided by Teradata:

Export Width Table Name Export-ID Description
Expected Default 0 Provides reasonable default widths for the character data type and client form of use.

This is the initial default table.

Compatibility Default 1 Enables Unicode data to be processed by applications that are written to process Latin or KANJI1 data.
Maximum Default 2 Provides maximum default width of the character data type and client form of use.

For information about how to use the DBS Control utility to set the system-level export width for your system, see Teradata Vantage™ - Database Utilities , B035-1102 .

You can override the system-level export width by using the EXPORTWIDTH option in the CREATE USER or MODIFY USER statements. For more information, see:
  • “CREATE USER” and “MODIFY USER” in Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144.
  • “Working with Export Widths” in Teradata Vantage™ - Advanced SQL Engine International Character Set Support, B035-1125.
  • “Export Width Procedures” in Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145.

HELP Statements

The export width rules determine HELP TABLE and HELP COLUMN statement results.