Variable Character Field (Varchar)
Definition - What does Variable Character Field (Varchar) mean?
A variable character field (varchar) is a data type which can contain any type of data: numeric, characters, spaces or punctuation. Depending on the database, the data type is capable of storing values up to its maximum size. Variable character fields are mostly used to act as temporary variables and for string operations. They bring in much-needed versatility for data field types.
Techopedia explains Variable Character Field (Varchar)
A variable character field can be defined either in the programming language or on the database level. A variable character field always has a declared maximum length and is usually initialized with the current length equal to zero. The current length of the variable character field can be anything from zero to the maximum declared field length. The method of declaring a variable character field differs according to the programming language used.
One of the biggest advantages of variable character fields is the avoidance of padding. In the case of a character field, the field occupies the exact number of characters regardless of the actual size of the string, and the difference between the fixed length and field length is padded with spaces. Unlike a character field, a variable character field only utilizes the space required for the size of the string, so only the minimum storage space is required. It helps in avoiding any wastage, and this feature is helpful in searching and sorting of values. In some databases and programming languages, any extra space found is automatically removed before storing to the database.
Based on the database or the programming language, there could be limitations on a variable character field, such as it cannot be used with select statement or cannot be used as a candidate or primary key.
Most relational database management systems support the variable character field.
Why Traditional Database Technology Fails to Scale
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Approaches and Benefits of Network Virtualization:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: