Character data consists of any combination of letters, symbols, and numeric characters. For example, valid character data includes “928”, “Johnson”, and “(0*&(%B99nh jkJ.”. In Microsoft® SQL Server™, character data is stored using the char, varchar, and text data types. Use varchar when a column’s entries vary in the number of characters they contain, but no entry’s length exceeds 8 kilobytes (KB). Use char when every entry for a column has the same fixed length (up to 8 KB). Columns of text data can be used to store ASCII characters that are longer than 8 KB. For example, because HTML documents are all ASCII characters and usually longer than 8 KB, they can be stored in text columns in SQL Server prior to being viewed in a browser.
It is recommended that the defined length of a character column be no larger than the maximum expected length of the character data to be stored.
To store international character data in SQL Server, use the nchar, nvarchar, and ntext data types.
char and varchar | Using Data Types |
ntext, text, and image | Using Text and Image Data |
Using char and varchar Data | Using Unicode Data |