Was this helpful?
Varchar(n) Data Type
Limits for the varchar(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 that follow.
DBMS
Varchar(n) Data Type Limits
Microsoft SQL Server
1–8000
Oracle
1–4000
ODBC
Host-specific; refer to SQLGetTypeInfo()
Embedded Nulls
Ingres allows embedded nulls with Microsoft SQL databases.
Microsoft SQL Server treats null as a terminator of varchar(n) data.
The gateway sets varchar(n) length to the first occurrence of null or the maximum length defined for varchar(n).
Microsoft SQL Server
The significant differences between Ingres and Microsoft SQL Server when dealing with the varchar(n) data type are partially handled by the gateway; the others are exposed to Ingres.
Create table statements that include varchar(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 varchar(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 (varcharcol varchar(8500))
becomes:
create table bigtab (varcharcol varchar(8000))
Last modified date: 08/22/2022