Example: Using STRING_CS to Determine the Client Character Set

Teradata Vantageā„¢ SQL Functions, Expressions, and Predicates

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

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