I have a question related to the sql schema generator.
I'm using a DB2 database.
Given a column of type varchar with length n the output in the result script of the schema generator is again n (generally correct).
-----------------------------
Example:
create table testschema.testtable (testcol varchar(40))
Output of schema generator:
CREATE TABLE "TESTSCHEMA"."TESTTABLE" (
"TESTCOL" VARCHAR(40)
)
IN "IDXSPACE"
ORGANIZE BY ROW
DATA CAPTURE NONE
COMPRESS NO
GO
-----------------------------
But, in DB2 there exists a setting called STRING_UNITS, c.f. https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.config.doc/doc/r0060936.html
The standard setting is SYSTEM, meaning the length is byte based. This corresponds to the result above.
Now, when I set it to value CODEUNITS32 the result is that the create table statement given in my example above develops into a testcol of width 40 x 4 = 160.
You can think of it moving from a byte based length to a literal based length at the cost that every literal needs 4 bytes.
My problem is now, when I script the database with setting the STRING_UNITS value to CODEUNITS32 I get:
-----------------------------
Result of schema generator:
CREATE TABLE "TESTSCHEMA"."TESTTABLE" (
"TESTCOL" VARCHAR(160)
)
IN "IDXSPACE"
ORGANIZE BY ROW
DATA CAPTURE NONE
COMPRESS NO
GO
-----------------------------
But, I cannot apply this script as this will multiply the 160 by 4 again.
So, my question is if it is possible to respect the settings and build a switch into the generation process which checks the STRING_UNITS variable and divides the value found by 4?
This will result in the original create table statement (length 40 again) which I can then execute without any manual division.
https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/sqlref/src/tpc/db2z_stringunitspec.html
Issue #15642 |
New |
Completion |
No due date |
No fixed build |
No time estimate |
https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/sqlref/src/tpc/db2z_stringunitspec.html