Max real space in a varbinary(max) in SQL Server

carlos picture carlos · Apr 20, 2011 · Viewed 74.3k times · Source

I am saving files (any type ) in a SQL table, using a varbinary(max), I find out that the max usage of this datatype is 8000, but what does the 8000 mean?

The online documentation says that is 8000 bytes. Does that mean that the maximum size of the file to be save there is 8000/1024 = 7.8125 KB?

I start testing and the maximum file that I can store is 29.9 MB. If I choose a larger file a get a SQLException.

String or binary data would be truncated. The statement has been terminated.

Answer

Eddy picture Eddy · Apr 20, 2011

Implement SQL Server 2012 (codename Denali) when it's released - it has FileTable feature :)

  • varbinary(8000) is limited by 8000 bytes - that's for sure!
  • varbinary(max) is limited by 2 gigabytes
  • varbinary(max) FILESTREAM is limited by your file system (FAT32 - 2 Gb, NTFS - 16 exabytes)