1
Answer

text data type in ms sql server

Photo of waffle

waffle

18y
2.2k
1
visual studio 2005 what is the differences between text, varchar and nvarchar data types in ms sql server? when and when not to use them?

Answers (1)

0
Photo of Simon
NA 66 0 18y
Hi,

The text data type is used for really long strings (up to 2^31-1 characters).

On the other side, varchar and char datatypes are used for shorter strings with which you specify the maximum length.
   Char automatically allocates for every row the maximum length you set in field definition while Varchar has the advantage of allocating only space for the text you insert into your field.

Finally, ntext is the equivalent of text but stands for Unicode Characters (n stands for National, so National Text in this case).
Similarly, nvarchar is for Unicode variable character length and nchar is for Unicode fixed character length.

You can find further information about Transact-SQL there : http://msdn2.microsoft.com/en-us/library/ms189826.aspx

Hope this helps!
Simon