SQL tables using VARCHAR with UTF8 (with respect to multi byte character length)
        Posted  
        
            by Elius
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Elius
        
        
        
        Published on 2010-04-30T09:03:45Z
        Indexed on 
            2010/04/30
            9:07 UTC
        
        
        Read the original article
        Hit count: 227
        
Like in Oracle VARCHAR( 60 CHAR ) I would like to specify a varchar field with variable length depending on the inserted characters.
for example:
create table X (text varchar(3))
insert into X (text) VALUES ('äöü')
Should be possible (with UTF8 as the default charset of the database).
On DB2 I got this Error: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001
 (Character data, right truncation occurred; for example, an update or insert value is a string that is too long for the column, or a datetime value cannot be assigned to a host variable, because it is too small.)
I'm looking for solutions for DB2, MsSql, MySql, Hypersonic.
© Stack Overflow or respective owner