char & varchar (data type)
data type char & varchar
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
char [ ( n ) ] | varchar [ ( n | max ) ]
Work example
Store non-Unicode text or UTF-8 text under a matching collation.
Use varchar for variable-width values and select a UTF-8 collation when the text must hold Unicode.
Check your work varchar capacity is measured in bytes, so character capacity depends on the encoding and collation.
Practice SQL
Open in SQL FlowSELECT CAST('North' AS varchar(20)) AS region_name;
Open Microsoft Learn for full syntax, permissions, and details for your version.