我知道 sql_variant
不能容纳大小为 nvarchar(max)
的项目。 sql_variant
可以容纳的nvarchar
或varchar
的最大大小是多少?
最佳答案
摘自 Microsoft
sql_variant can have a maximum length of 8016 bytes. This includes both the base type information and the base type value. The maximum length of the actual base type value is 8,000 bytes.
为了进一步回答您的问题,您可以使用 8k 长度的 varchar 或 4k 长度的 nvarchar。
正如上述文档所指出的,输出永远不会超过 8,000 字节。
more info关于 varchar 和 nvarchar
关于sql-server - SQL : Maximum (n)varchar size can be stored in sql_variant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46075140/