I don\'t know if there\'s a limit to the number of characters if I choose nvarchar(MAX), and I\'m not sure how many characters I would need anyways.
What\'s the standard
The default setting for NVARCHAR(MAX) is to store its text value in the table structure, unless the text is over 8,000 bytes (which is 4000 double-byte chars), at which point it behaves like an NTEXT and stores the text value in the LOB, and stores a pointer to the text in the table - which gives much worse performance.
In short, go for NVARCHAR(4000)
, as long as it's OK to lose bytes over 8K long.
The ntext
type is deprecated, as are text
and image
. Microsoft recommends replacing them with nvarchar(max)
, varchar(max)
and varbinary(max)
respectively.
Use nvarchar(max)
, therefore.
Reference:
The advantages of using nvarchar(MAX) are that you can run functions such as Replace, Left, Len etc on nvarchar(MAX) but not on ntext. ntext local variables also cannot be created in stored procedures however nvarchar(MAX) can.
ntext is also likely to be deprecated in the future in favour of nvarchar(MAX) see:
ntext, text, and image