What is the maximum file size that I can insert using varbinary (max) in SQL Server 2008 R2? I tried to change the maximum value in the column to more than 8000 bytes, but this will not allow me, so I assume that max is 8000 bytes, but from this article on MSDN , it says that the maximum storage size is 2 ^ 31-1 bytes :
varbinary [(n | max )]
Binary data of variable length. n can be a value from 1 to 8000. max indicates that the maximum storage size is 2 ^ 31-1 bytes. Storage size is the actual length of the entered data + 2 bytes. Entered data can be 0 bytes long. The ANSI SQL synonym for varbinary is binary different .
So how can I store large files in a varbinary field? I do not consider using FILESTREAM, since the files I want to save are from 200 kb to 1 mb, the code that I use:
UPDATE [table] SET file = ( SELECT * FROM OPENROWSET ( BULK 'C:\A directory\A file.ext', SINGLE BLOB) alias) WHERE idRow = 1
I managed to execute this code successfully so that the files were less than or equal to 8000 bytes. If I try with a file size of 8001 bytes, it will fail. In my file field in the table there is a field of type "file" varbinary(8000) , which, as I said, cannot change to a larger value.
Diego ramos
source share