SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Language Elements
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
6-24
Character String Data Types
If you do not want to have blanks added to your character string, you can specify a
variable-length character column as VARCHAR(n), where n is the maximum number of
characters you want to store. If you store five characters in a column specified as
VARCHAR(10), only the five characters are stored logically—without blank padding.
When you are creating SQL/MP tables, group all variable-length columns after all
fixed-length columns for faster access. This practice also allows for more efficient use
of disk storage. For SQL/MX tables, the executor will put variable-length columns in the
most effective place.
Maximum Byte Length of a Character Column
The maximum length of a character column in an SQL/MP Format 1 table depends on
whether the data type is fixed-length or variable-length and on the file organization of
the file that contains the column. All SQL/MX tables are key-sequenced files.
Each variable-length character data item requires eight characters of storage for length
information, in addition to the space required for the data itself. As a result, the
maximum length for a variable-length column is less than the maximum length for an
otherwise equivalent fixed-length column.
A column that allows null value requires two extra storage characters.
Collations and Character Sets
For SQL/MX Release 2.x, a character data type can be associated only with the
DEFAULT collation. You set the default NCHAR data type when you install NonStop
SQL/MX, and you can select from the ISO88591, UCS2, KANJI or KSC5601 character
sets. If you do not make a selection, the default is UCS2.
Data Type Key-Sequenced Entry-Sequenced
SQL/MP Format 1 tables:
Single-byte fixed-length 4061 4072
Single-byte variable-length 4059 4070
Double-byte fixed-length 2030 2036
Double-byte variable-length 2029 2035
SQL/MX tables:
4K block size 4040
*
Not applicable
32K block size 32712
**
Not applicable
*The maximum row size is 4040 bytes, but the actual row size is less than that because of bytes used
by the header, null indicator, column length indicator, and other system features.
**The maximum row size is 32712 bytes, but the actual row size is less than that because of bytes
used by the header, null indicator, column length indicator, and other system features.
For information about the maximum row size available to users, see Table 2-2
.
Note. SQL/MX tables do not support the KANJI or KSC5601 character sets. If you attempt to
create an SQL/MX table with these or other unsupported character set types, an SQL error is
returned and the operation fails.