0

Except for the different amount of data it can store, what is the implementation / storage difference between varbinary(8000) and varbinary(max) in SQL Server 2019?

The official docs just say to use varbinary(max) for column data with more than 8000 bytes, without going in any details, how e.g. a theoretical (if one could create it) varbinary(9999) would be different from varbinary(max).

stefan.at.kotlin
  • 15,347
  • 38
  • 147
  • 270
  • 1
    In this duplicate, it's the same reason even though it's `varchar` instead of `varbinary. It would also be the same for `nvarchar(4000)` as that uses UTF-16 which requires 2 bytes per character. – DavidG Dec 11 '20 at 11:37
  • @DavidG Yes, this answers my question. Thanks :-) – stefan.at.kotlin Dec 11 '20 at 11:39
  • The reason for the max of (8000) is an underneath the hood thing. Each page of storage is 8k. If you go above that, you need (max). It should be obvious, but if you have anything other columns in the table varbinary(8000) would be unwise. – Gregory A Beamer Dec 11 '20 at 19:19

0 Answers0