sql - 始终使用 nvarchar(MAX) 有什么缺点吗?

标签 sql sql-server sql-server-2005

在 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/

相关文章:

mysql - 我的sql查询一直在获取,是代码还是其他什么?

sql-server-2005 - 模块化应用数据库结构

SQL Server : stored procedure IFNULL check

sql-server - SQL Server 性能和更新统计信息

c# - 从 SQL 数据库中检索 varbinary 数据字段

php - 从sql数据库中选择数据不起作用。我如何解决它?

c# - 我需要将交叉引用表与 Entity Framework 一起使用

sql-server - SQL 递增整数列,即使为 null

sql - 处理 SQL FILESTREAM 数据损坏和备份

sql-server - 将存储过程选择结果读入 pandas 数据帧