0

I am working with AS400 system. I need to create tables with different encoding for validation task. I tested with

CREATE TABLE TESTSCH.EBCDIC_TBL (
COLUMN1 VARCHAR(100),
COLUMN2 INTEGER
) CCSID ebcdic;

However this is not working and throwing below error.

QL Error [42601]: [SQL0199] Keyword CCSID not expected

How to create a table with different encoding EBCDIC/ Unicode ASCII etc.

I am using Dbeaver to connect to AS400 system.

4
  • What version of Db2 i? Did you have a chance to look at the CREATE TABLE syntax in documentation?
    – mustaccio
    Oct 20, 2022 at 12:32
  • Version 11. I followed this link ibm.com/docs/en/db2-for-zos/…
    – Anand
    Oct 20, 2022 at 13:24
  • There's no IBM i version 11, and your link is for z/OS.
    – mustaccio
    Oct 20, 2022 at 13:27
  • z/OS is not the same as IBM i (aka iSeries)...
    – Charles
    Oct 20, 2022 at 13:28

1 Answer 1

0

The doc's you linked to in your comment are for Db2 for z/OS, which is not the same as IBM i (aka iSeries).

Here's the Db2 for IBM i docs for the CREATE TABLE statement.

And here's what your statement should look like assuming you want CCSID 37 US English

CREATE TABLE TESTSCH.EBCDIC_TBL (
COLUMN1 VARCHAR(100) ccsid 37,
COLUMN2 INTEGER
);

Other CCSID's can be found here

Also note that assuming a supported version of the OS, for Unicode UTF-16 you can use NVARCHAR instead of VARCHAR(xxx) ccsid 1200

CREATE TABLE TESTSCH.UTF16_TBL (
COLUMN1 NVARCHAR(100),
COLUMN2 INTEGER
);
1
  • Thanks for clarification. Appreciate it.
    – Anand
    Oct 20, 2022 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.