SQL:最大varchar大小可以存储在sql_variant中

时间:2021-11-13 16:55:32

I know that sql_variant cant hold items of size nvarchar(max). Which is the maximum size of nvarchar or varchar that sql_variant can hold?

我知道sql_variant无法保存大小为nvarchar(max)的条目。sql_variant可以保存的nvarchar或varchar的最大大小是多少?

2 个解决方案

#1


2  

as pulled from 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.

sql_variant的最大长度为8016字节。这包括基本类型信息和基本类型值。实际基类型值的最大长度为8000字节。

to answer your question more you can have a varchar of 8k length or a nvarchar of 4k length.

要回答你的问题,你可以有8k长度的varchar或4k长度的nvarchar。

As the above documentation points out the output will never be larger then 8,000 bytes.

正如上面的文档所指出的,输出将永远不会大于8000字节。

more info on varchar and nvarchar

更多关于varchar和nvarchar的信息

#2


2  

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.

sql_variant的最大长度为8016字节。这包括基本类型信息和基本类型值。实际基类型值的最大长度为8000字节。

From Microsoft docs.

从微软文档。

#1


2  

as pulled from 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.

sql_variant的最大长度为8016字节。这包括基本类型信息和基本类型值。实际基类型值的最大长度为8000字节。

to answer your question more you can have a varchar of 8k length or a nvarchar of 4k length.

要回答你的问题,你可以有8k长度的varchar或4k长度的nvarchar。

As the above documentation points out the output will never be larger then 8,000 bytes.

正如上面的文档所指出的,输出将永远不会大于8000字节。

more info on varchar and nvarchar

更多关于varchar和nvarchar的信息

#2


2  

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.

sql_variant的最大长度为8016字节。这包括基本类型信息和基本类型值。实际基类型值的最大长度为8000字节。

From Microsoft docs.

从微软文档。