16.20 - Example: Using STRING_CS to Determine the Client Character Set - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2020-03-25
dita:mapPath
xzf1512079057909.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
kby1472250656485

Consider the following table definition:

   CREATE TABLE SysNames
      (SysID INTEGER
      ,SysName VARCHAR(30) CHARACTER SET KANJI1);

Suppose the session character set is KANJIEBCDIC5026_0I. The following statement inserts the mixed single-byte/multibyte character string '<TEST >Q' into the SysName column of the SysNames table:

   INSERT SysNames (101, '0E42E342C542E242E30FD8'XC);

Using STRING_CS to determine the client character set that was used to encode the string produces the results that follow:

   SELECT STRING_CS(SysName) FROM SysNames WHERE SysID = 101;
   String_CS(SysName)
   ------------------
                    1