Character Data

Creating and Maintaining Databases

Creating and Maintaining Databases

Character Data

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™ 2000, character data is stored using the char, varchar, and text data types. Use varchar when the entries in a column vary in the number of characters they contain, but the length of any entry does not 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 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.

See Also

char and varchar

ntext, text, and image

Using char and varchar Data

Using Data Types

Using text and image Data

Using Unicode Data