哪些数据类型存储图像和文件在SQL Server 2005数据类型、图像、文件、Server

2023-09-02 10:52:04 作者:靓到没朋友

我必须扩展现有的.NET应用程序存储在SQL Server图像和文档(主要是PDF格式的)2005数据库。

I must extend an existing .net-Application to store images and documents (mostly pdf's) in a SQL Server 2005 database.

哪个SQL Server的数据类型用于最佳保存这些文件和是它meaningfull来创建包含字段,或者是它没有问题的,直接的正常业务表中把这些字段一个单独的表,只要select语句不选择它们(或SELECT *)。

Which SQL Server datatype is used best for saving these files and is it meaningfull to create a separate table that holds the fields, or is it no problem to put these fields directly in the "normal" business tables, as long as the select statements do not select them (or SELECT *).

推荐答案

VARBINARY或FILESTREAM

VARBINARY or FILESTREAM

没有必要将它们存储在一个单独的表 - 有内置控件,你可以用它来强制使用sp_tableoption存储在输入/输出的行:

No need to store them in a separate table - there are built-in controls you can use to force it to be stored in/out of row using sp_tableoption:

http://msdn.microsoft.com/en-us/library/ ms189087.aspx

http://msdn.microsoft.com/en-us/library/ ms186981.aspx

的http://www.microsoft.com/sqlserver/2008/en/us/wp-sql-2008-manage-unstructured.aspx

(注意,有可能是利益,在一个单独的表中存储,如果你使用的是不同的文件组,并在备份单独或类似的东西 - 但是这可能被视为例外)

(Note that there might be benefits to storing in a separate table if you are using different filegroups and backing them up independently or something like that - but that might be considered exceptional)