Determining the CCSID of Db2 data

Db2 can store EBCDIC, ASCII, and Unicode data.

Procedure

To determine the CCSID of Db2 data, use one of the following techniques:

  • To find the CCSID of data that is stored in Db2 tables, check one of the following catalog tables:
    • SYSIBM.SYSCOLUMNS (the FOREIGNKEY and CCSID columns)
      SELECT FOREIGNKEY, CCSID
        FROM SYSIBM.SYSCOLUMNS
        WHERE NAME = 'column-name'
    • SYSIBM.SYSDATABASE (the SBCS_CCSID, MIXED_CCSID, and DBCS_CCSID columns)
      SELECT SBCS_CCSID, MIXED_CCSID, DBCS_CCSID
        FROM SYSIBM.SYSDATABASE
        WHERE NAME = 'database-name'
    • SYSIBM.SYSTABLES (the ENCODING_SCHEME column)
      SELECT ENCODING_SCHEME
        FROM SYSIBM.SYSTABLES
        WHERE NAME = 'table-name'
    • SYSIBM.SYSTABLESPACE (the SBCS_CCSID, MIXED_CCSID, and DBCS_CCSID columns)
      SELECT SBCS_CCSID, MIXED_CCSID, DBCS_CCSID
        FROM SYSIBM.SYSTABLESPACE
        WHERE NAME = 'tablespace-name'
    • SYSIBM.SYSKEYTARGETS (the CCSID column)
      SELECT CCSID
        FROM SYSIBM.SYSKEYTARGETS
        WHERE IXNAME = 'keytarget-name'
  • To find the CCSID of a distinct type, check the SYSIBM.SYSDATATYPES catalog table (the ENCODING_SCHEME column).
  • To find the CCSID of routine parameters, check one of the following catalog tables:
    • SYSIBM.SYSPARMS (the CCSID column)
    • SYSIBM.SYSROUTINES (the PARAMETER_CCSID column)
  • To find the CCSID of application data, check one of the following catalog tables:
    • SYSIBM.SYSPACKAGE (the ENCODING_CCSID column)
    • SYSIBM.SYSPLAN (the ENCODING_CCSID column)
    • SYSIBM.SYSENVIRONMENT (the APPLICATION_ ENCODING_CCSID column)
  • To find the subsystem CCSIDs, follow the instructions for Determining current subsystem CCSID and encoding scheme values.