I have read about Are there any disadvantages to always using nvarchar(MAX) and varchar(max) vs varchar(255) from different forums. Now, I wonder if it is ideal/safe practice to convert a text
datatype to nvarchar(MAX)
? Are there any performance difference? or do I need to specify the size (as in nvarchar(255)
) instead of nvarchar(max)
?
Answer is very simple: text
type is deprecated. So, yes, you should convert a text
datatype to varchar(MAX)
.
https://msdn.microsoft.com/en-AU/library/ms187993.aspx
ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.
On top of that, if you know that the size of your text
is less than 8000, then use varchar(nnn)
instead of varchar(max)
. varchar(nnn)
is more efficient than varchar(max)
.
Note: text
type is for non-unicode text, so use varchar
instead. ntext
is for unicode text, so use nvarchar
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.