All Forums Database
ywjcjj 36 posts Joined 06/08
18 Aug 2008
default characterset

I changed the user default characterset to LATIN. But whenever I am using CREATE TABLE AS statement, the default characterset for string fields are still unicode. For example:create table test as(select year, state, county, 'abc' as flgfrom table1group by 1,2,3,4) with dataunique primary index (year, state, county, flg);show table test;The field 'flg' is flg VARCHAR(3) CHARACTER SET UNICODE NOT CASESPECIFICHow can I change the default characterset to 'LATIN'

David Craig 3 posts Joined 10/08
24 Oct 2008

String literals are always Unicode strings in the Teradata database. The user default characterset does not apply to string literals. You could add the char latin column after the 'create table as' with an 'alter table' using a default value of 'abc'.--i18nguy

joedsilva 505 posts Joined 07/05
24 Oct 2008

One trick is to use the translate function in the select to explicitly state the fields as LATIN

12 May 2009

The following code forces the character set to LATIN:CREATE TABLE DB.ANDY_TEMP AS (SELECT PRD_ID,AV_BAL,TRANSLATE((CASEWHEN AV_BAL > 10000THEN 'RICH'WHEN AV_BAL < 10000THEN 'NOT SO RICH'ELSE 'NO BALANCE'END) AS UNICODE_TO_LATIN) AS BALANCE_BANDFROM BALANCE_TABLE)WITH DATA AND STATISTICSUNIQUE PRIMARY INDEX (PRD_ID);One question though is to the processing overhead of the translation. Does anyone know how much this sort of operation adds to the processing?Thanks!!!Andy

Andrew Livingston
EMEA - Customer Education Consultant
Teradata UK
206 Marylebone Road
London NW1 6LY
United Kingdom

M: +44 7785 971 080
E-mail: Andrew.Livingston@Teradata.com

You must sign in to leave a comment.