Should I avoid use of TEXT, NTEXT datatypes?
I'm making a blog, article website so i decide to use NTEXT data type for blog and article contents. Until i see this
Important
ntext, text, and image data types will be removed in a future version of MicrosoftSQL 开发者_运维知识库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.
Fixed and variable-length data types for storing large non-Unicode and Unicode character and binary data. Unicode data uses the UNICODE UCS-2 character set. (http://msdn.microsoft.com/en-us/library/ms187993.aspx)
Im sure that blog and article contents gonna reach 4000 character limit if i use nvarchar(max). What data type should i use at this case?
You should use nvarchar(max)/varchar(max) - that's current pair of text types.
When using these types you have no limit for field size (well, actually the limit is 2 Gb, but I don't think you'll hit it).
See MSDN for more details:
- data types in SQL Server
- nchar and nvarchar types
精彩评论