在 SQL Server 2005 中,将所有字符字段设置为 nvarchar(MAX) 而不是显式指定长度有什么缺点吗? nvarchar(255)? (除了明显的一点,您无法在数据库级别限制字段长度)
最佳答案
MSDN 论坛上也提出了同样的问题:
来自原始帖子(那里有更多信息):
When you store data to a VARCHAR(N) column, the values are physically stored in the same way. But when you store it to a VARCHAR(MAX) column, behind the screen the data is handled as a TEXT value. So there is some additional processing needed when dealing with a VARCHAR(MAX) value. (only if the size exceeds 8000)
VARCHAR(MAX) or NVARCHAR(MAX) is considered as a 'large value type'. Large value types are usually stored 'out of row'. It means that the data row will have a pointer to another location where the 'large value' is stored...
关于sql - 始终使用 nvarchar(MAX) 有什么缺点吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/148398/