3

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?

aggicd
  • 727
  • 6
  • 28

2 Answers2

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.

From Microsoft docs.

sagi
  • 40,026
  • 6
  • 59
  • 84
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.

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

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

more info on varchar and nvarchar

ttallierchio
  • 460
  • 7
  • 17