Migrated data with Special Characters Counted as 2 Characters in DB2 Linux We are currently migrating data from DB2 10.1 AIX to DB2 11.1 Linux. Since we are using some features like versioning/history tables and rowchangetimestamps, db2move is not an option for some tables. As a result we do manual export and load for some tables.

The problem arrises for data having special character such as "Ñ". 


  Sample Data
  
  PIÑATA


The AIX DB2 10.1 Counts the length for this as 6 characters and it fits fine to VARCHAR(6) columns. But when I load this to DB2 Linux 11.1, this is counted as 7 characters, thus data is truncated.

I tried CASTING this as VARCHAR(6) but the data is still truncated. I hope someone can point me to a possible solution.
Every character needs 1 byte in a single-byte database, but it may need from 1 to 4 bytes in a UTF-8 database.
When you specify VARCHAR(N) for a column, N is defined in string units.
OCTETS means bytes, and CODEUNITS32 means characters.
In your case N probably is OCTETS, and since Ñ character requires 2 bytes (OCTETS), then whole string length in the UTF-8 database is 7.
Character strings