Ispirer Website
Ispirer Capabilities - DB2 Migration
Free Trial
IBM DB2 Data Types - VARCHAR
Versions: IBM DB2 9.x, 8.x, 7.x, 6.1 and 5.2
DB2 - VARCHAR | |
---|---|
Syntax | VARCHAR(n) [FOR BIT DATA] |
Data | Variable-length character data |
Parameters | n is the maximum number of bytes, mandatory. If FOR BITA DATA is specified the column data is treated as binary data |
Range | 1 ⇐ n ⇐ 32672. The maximum n was 4000 before version 7.x. |
Padding | Not right-padded with spaces to n |
Empty String | '' is treated as empty string |
Storage Size | n bytes |
Synonyms | CHARACTER VARYING, CHAR VARYING |
Standards | ANSI SQL |
Example:
CREATE TABLE t_varchar (col1 VARCHAR(200))
IBM DB2 VARCHAR - Equivalents in Other Databases
Database | Data Type and Conversion |
---|---|
Oracle | VARCHAR2(n), 1 ⇐ n ⇐ 4000/charsize |
SQL Server | VARCHAR(n), 1 ⇐ n ⇐ 8000 |
MySQL | VARCHAR(n), 1 ⇐ n ⇐ 65535 |
PostgreSQL | VARCHAR(n), 1 ⇐ n ⇐ 1G |
Sybase ASE | VARCHAR(n), 1 ⇐ n ⇐ pagesize (2K, 4K, 8K or 16K) |
Sybase ASA | VARCHAR(n), 1 ⇐ n ⇐ 32767/charsize |
Informix DS | VARCHAR(n), 1 ⇐ n ⇐ 255 |
Teradata | VARCHAR(n), 1 ⇐ n ⇐ 64000/charsize |
Interbase/Firebird | VARCHAR(n), 1 ⇐ n ⇐ 32765/charsize |
Ingres | VARCHAR(n), 1 ⇐ n ⇐ 32000 |
All Data Types