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?,
我在sql表中保存文件(任何类型),使用varbinary(max),我发现这个数据类型的最大用法是8000,但是8000是什么意思?
The online documentation says that is 8000 bytes, that means that the maximum size of the file to be save there is 8000/1024 = 7.8125 KB ?,
在线文档说这是8000字节,这意味着要保存的文件的最大大小是8000/1024 = 7.8125 KB ?,
I start testing and the maximum file that I can store is of 29.9 MB, if I choose a larger file a get an Sqlexception "String or binary data would be truncated. The statement has been terminated." ...
我开始测试,我可以存储的最大文件是29.9 MB,如果我选择一个更大的文件,得到一个Sqlexception“字符串或二进制数据将被截断。该语句已被终止。” ...
Thanks a lot for any comments.
非常感谢任何评论。
4 个解决方案
#1
30
Implement SQL Server 2012 (codename Denali) when it's released - it has FileTable
feature :)
在它发布时实现SQL Server 2012(代号Denali) - 它具有FileTable功能:)
-
varbinary(8000)
is limited by 8000 bytes - that's for sure! - varbinary(8000)受限于8000字节 - 这是肯定的!
-
varbinary(max)
is limited by 2 gigabytes - varbinary(max)限制为2千兆字节
-
varbinary(max) FILESTREAM
is limited by your file system (FAT32 - 2 Gb, NTFS - 16 exabytes) - varbinary(max)FILESTREAM受文件系统的限制(FAT32 - 2 Gb,NTFS - 16 exabytes)
#2
9
Taken from here:
取自这里:
http://msdn.microsoft.com/en-us/library/ms188362.aspx:
http://msdn.microsoft.com/en-us/library/ms188362.aspx:
max indicates that the maximum storage size is 2³¹-1 bytes
max表示最大存储大小为2³¹-1字节
which is 2 147 483 647 bytes. I'm not sure why it stops at 29.9MB.
这是2 147 483 647字节。我不知道为什么它停在29.9MB。
#3
4
What version of SQL Server are you using?
您使用的是哪个版本的SQL Server?
Varbinary on MSDN for SQL Server 2008 explicitly says that VarBinary(MAX) is for use when "the column data entries exceed 8,000 bytes."
SQL Server 2008的MSDN上的Varbinary明确表示VarBinary(MAX)用于“列数据条目超过8,000个字节”。
Also, I would also take a look at the Filestream Capabilities in SQL Server 2008 if that is the server you are using.
另外,如果那是您正在使用的服务器,我还将查看SQL Server 2008中的文件流功能。
#4
4
I got the "String or binary data would be truncated" error when trying to store 5MB using varbinary(max) on SQL Server 2005. Increasing the autogrowth size for the database solved the problem. Took me a while to figure out, so just thought I'd share :)
尝试在SQL Server 2005上使用varbinary(max)存储5MB时,我得到“字符串或二进制数据将被截断”错误。增加数据库的自动增长大小解决了问题。花了一些时间弄明白,所以只是想我分享:)
#1
30
Implement SQL Server 2012 (codename Denali) when it's released - it has FileTable
feature :)
在它发布时实现SQL Server 2012(代号Denali) - 它具有FileTable功能:)
-
varbinary(8000)
is limited by 8000 bytes - that's for sure! - varbinary(8000)受限于8000字节 - 这是肯定的!
-
varbinary(max)
is limited by 2 gigabytes - varbinary(max)限制为2千兆字节
-
varbinary(max) FILESTREAM
is limited by your file system (FAT32 - 2 Gb, NTFS - 16 exabytes) - varbinary(max)FILESTREAM受文件系统的限制(FAT32 - 2 Gb,NTFS - 16 exabytes)
#2
9
Taken from here:
取自这里:
http://msdn.microsoft.com/en-us/library/ms188362.aspx:
http://msdn.microsoft.com/en-us/library/ms188362.aspx:
max indicates that the maximum storage size is 2³¹-1 bytes
max表示最大存储大小为2³¹-1字节
which is 2 147 483 647 bytes. I'm not sure why it stops at 29.9MB.
这是2 147 483 647字节。我不知道为什么它停在29.9MB。
#3
4
What version of SQL Server are you using?
您使用的是哪个版本的SQL Server?
Varbinary on MSDN for SQL Server 2008 explicitly says that VarBinary(MAX) is for use when "the column data entries exceed 8,000 bytes."
SQL Server 2008的MSDN上的Varbinary明确表示VarBinary(MAX)用于“列数据条目超过8,000个字节”。
Also, I would also take a look at the Filestream Capabilities in SQL Server 2008 if that is the server you are using.
另外,如果那是您正在使用的服务器,我还将查看SQL Server 2008中的文件流功能。
#4
4
I got the "String or binary data would be truncated" error when trying to store 5MB using varbinary(max) on SQL Server 2005. Increasing the autogrowth size for the database solved the problem. Took me a while to figure out, so just thought I'd share :)
尝试在SQL Server 2005上使用varbinary(max)存储5MB时,我得到“字符串或二进制数据将被截断”错误。增加数据库的自动增长大小解决了问题。花了一些时间弄明白,所以只是想我分享:)