I must extend an existing .net-Application to store images and documents (mostly pdf's) in a SQL Server 2005 database.
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 *).
SQL Server 2005: Blobvarchar(max)
SQL Server 2008: FileStream
VARBINARY or FILESTREAM
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With