Ispirer Website Ispirer Capabilities - Microsoft SQL Server Migration Free Trial

SQL Server Data Types - VARCHAR

Versions: SQL Server 2008, 2005, 2000, 7.0 and 6.5

SQL Server - VARCHAR
Syntax VARCHAR[(n | max)]
Data Variable-length character data, single-byte and multibyte character sets
Parameters n is the maximum number of bytes, optional
Range 1 ⇐ n ⇐ 8000, if max is specified, the maximum length is 2G
Default n is 1
Padding Not right-padded with spaces to n
Trailing Spaces if ANSI_PADDING is ON, trailing blanks are not trimmed, if ANSI_PADDING is OFF, trailing blanks are trimmed
Empty String '' is treated as empty string, 0 characters in length
Character Set Database default, unless it is assigned using the COLLATE clause
Storage Size Actual entry length + 2 bytes
Version Differences SQL Server 2005 - max option is introduced
Synonyms CHAR VARYING, CHARACTER VARYING
Standards ANSI SQL

SQL Server VARCHAR - Equivalents in Other Databases

Database Data Type and Conversion
Oracle VARCHAR(n), 1 ⇐ n ⇐ 4000/charsize CLOB, 4G
MySQL VARCHAR(n), 1 ⇐ n ⇐ 65535/charsize LONGTEXT, 4G
PostgreSQL VARCHAR(n), 1 ⇐ n ⇐ 1G TEXT, 1G
Sybase ASE VARCHAR(n), 1 ⇐ n ⇐ pagesize (2K, 4K, 8K or 16K) TEXT, 2G
Informix VARCHAR(n,r), 1 ⇐ n ⇐ 255, LVARCHAR(n), 1 ⇐ n ⇐ 32739 TEXT, 2G, CLOB, 4T
HP Neoview VARCHAR(n), 1 ⇐ n ⇐ (32708 - size of other columns)
Ingres VARCHAR(n), 1 ⇐ n ⇐ 32000; TEXT(n), 1 ⇐ n ⇐ 32000; LONG VARCHAR, 2G

Related Data Types in SQL Server

Data Types
Fixed-length Character Data CHAR(n) NCHAR(n)
Variable-length Character Data NVARCHAR(n)
Character Large Objects TEXT NTEXT

All Data Types


© 1999-2024, Ispirer Systems, LLC. All Rights Reserved.