Teradata在特殊字符前添加Â

时间:2017-04-06 09:43:12

标签: database character-encoding teradata

我遇到一个问题,当从.csv文件加载时,快速将数据加载到Teradata Table中会导致Â出现在特殊字符前面。

CSV文件

1 |您好,从您的帐户中扣除了5.00英镑,谢谢您的付款。| XXXX | XX | XXXX-XXX-XXX

Teradata表

1 |您好,从您的帐户中扣除了£5.00,谢谢您的付款。| XXXX | XX | XXXX-XXX-XXX

表格定义

CREATE MULTISET TABLE DATABASE1.TABLE1 ,NO FALLBACK ,
 NO BEFORE JOURNAL,
 NO AFTER JOURNAL,
 CHECKSUM = DEFAULT,
 DEFAULT MERGEBLOCKRATIO
 (
  FIELD1 VARCHAR(25) CHARACTER SET LATIN NOT CASESPECIFIC,
  FIELD2 VARCHAR(750) CHARACTER SET LATIN NOT CASESPECIFIC,
  FIELD3 VARCHAR(35) CHARACTER SET LATIN NOT CASESPECIFIC,
  FIELD4 VARCHAR(35) CHARACTER SET LATIN NOT CASESPECIFIC,
  FIELD5 VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC
 ) PRIMARY INDEX ( FIELD1 );

快速加载代码

fastload <<-EOF
    .LOGON username/pass;
    DATABASE DATABASE1;

        SET RECORD VARTEXT "|";

        BEGIN LOADING TABLE1
            ERRORFILES TABLE1_ERR1,
                       TABLE1_ERR2;

        DEFINE
            FIELD1      (VARCHAR(25))
            FIELD2      (VARCHAR(750))
            FIELD3      (VARCHAR(35))
            FIELD4      (VARCHAR(35))
            FIELD5      (VARCHAR(50))


        FILE=${LOAD_FILE};

        SHOW;

        INSERT INTO DATABASE1.TABLE1
        (
            FIELD1 ,
            FIELD2 ,
            FIELD3 ,
            FIELD4 ,
            FIELD5 

        )
        VALUES
        (
            :FIELD1 ,
            :FIELD2 ,
            :FIELD3 ,
            :FIELD4 ,
            :FIELD5 
        );

    .END LOADING;
    .LOGOFF;
    .QUIT;
EOF

有谁知道如何解决这个问题,我是从Solaris 10 Fastload Utility v12.00.00.011运行的

1 个答案:

答案 0 :(得分:0)

fastload的默认字符集是ANSII,£是UTF8,解决方法是在fastload函数中更改会话字符集。

fastload <<-EOF
    SET SESSION CHARSET 'UTF8';
    .LOGON username/pass;
    DATABASE DATABASE1;

    SET RECORD VARTEXT "|";

    BEGIN LOADING TABLE1
        ERRORFILES TABLE1_ERR1,
                   TABLE1_ERR2;

    DEFINE
        FIELD1      (VARCHAR(25))
        FIELD2      (VARCHAR(750))
        FIELD3      (VARCHAR(35))
        FIELD4      (VARCHAR(35))
        FIELD5      (VARCHAR(50))


    FILE=${LOAD_FILE};

    SHOW;

    INSERT INTO DATABASE1.TABLE1
    (
        FIELD1 ,
        FIELD2 ,
        FIELD3 ,
        FIELD4 ,
        FIELD5 

    )
    VALUES
    (
        :FIELD1 ,
        :FIELD2 ,
        :FIELD3 ,
        :FIELD4 ,
        :FIELD5 
    );

.END LOADING;
.LOGOFF;
.QUIT;
EOF