[WEBINAR] Bulletproof: How Today's Business Leaders Stay on Top

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.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.