{{Short description|Set of character data in a database}} A '''VARCHAR''' or '''variable character field''' is a set of [[Character (computing)|character]] [[data]] of indeterminate length. The term ''varchar'' refers to a data type of a field (or [[Column (database)|column]]) in a [[database management system|database]] which can hold letters and numbers.<ref>{{Cite web |date=2018-10-25 |title=The VARCHAR data type |url=https://www.ibm.com/docs/en/informix-servers/12.10.0?topic=ocdt-varchar-data-type |access-date=2025-11-25 |website=www.ibm.com |language=en-us}}</ref> Varchar fields can be of any size up to a limit, which varies by databases: an [[Oracle database|Oracle 11g]] database has a limit of 4000 bytes,<ref>{{cite web|url=https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1835|title=Database Concepts|website=docs.oracle.com}}</ref> a [[MySQL | MySQL 5.7]] database has a limit of 65,535 bytes (for the entire row)<ref>{{cite web|url=https://dev.mysql.com/doc/refman/5.7/en/char.html|title=MySQL :: MySQL 5.7 Reference Manual :: 11.4.1 The CHAR and VARCHAR Types|website=dev.mysql.com}}</ref> and [[Microsoft SQL Server| Microsoft SQL Server 2008]] has a limit of 8000 bytes (unless varchar(max) is used, which has a maximum storage capacity of 2 gigabytes).<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/ms176089.aspx|title=char and varchar (Transact-SQL)|last=edmacauley|website=msdn.microsoft.com|date=6 June 2024 }}</ref>
<code>nvarchar</code> is a variation of <code>varchar</code>,<ref>[https://www.mssqltips.com/sqlservertip/4322/sql-server-differences-of-char-nchar-varchar-and-nvarchar-data-types/ SQL Server differences of char, nchar, varchar and nvarchar data types]</ref> and which is more suitable depends on the [[use case]].{{clarify|date=June 2021}}
==See also== * [[SQL data types]]
==References== {{Reflist}}
[[Category:SQL]] [[Category:Data types]]
{{database-stub}}