Developing Portable Applications : 3. Application Considerations : Data Type Limits : Char(n) Data Type
 
Share this page                  
Char(n) Data Type
Limits for the char(n) data type, where (n) is the numeric character length, are summarized in the following table. The gateway requires the length to be explicitly specified. If length is not specified, it will trigger a gateway syntax error. This differs from the Ingres DBMS, which defaults the length to 1 if it is not specified. For detailed information about individual gateways, see the sections following the table.
DBMS
Char(n) Data Type Limits
Microsoft SQL
1–8000
Oracle
1–2000
DB2 UDB
1–254-Maximum length for char(n) and character(n) columns
Microsoft SQL Server
Create table statements that include char(n) columns with a length greater than the Microsoft SQL Server maximum are automatically reduced by the gateway to the maximum length. Insert statements for char(n) columns that include data greater than the Microsoft SQL Server maximum are also automatically truncated by the gateway to the maximum length. For example, the following create table statement is changed as shown:
create table bigtab (charcol char(8500))
becomes:
create table bigtab (charcol char(8000))
DB2 UDB
DB2 UDB imposes a maximum length of 254 on char(n) columns. Therefore, DB2 UDB gateway char(n) columns are limited to a maximum length of 254. Because character(n) is mapped to the char(n) data type, this limitation also applies to the character(n) data type.