I'm currently reviewing and strengthening my SQL Server skills when I came into this dilemma. For a web based application, would it be
better to store images in SQL Server or would it be better to store the images in the file system and just store the "file path" or the link (e.g." C:\images\image1.jpg") to SQL server
Why should I bother? It's the client call anyway? But as a matter of principle which is the right way to go.
Images and photos are Binary large objects to begin with. For reference see the link below.
This is of great advantage for applications that have:
The right way of doing this is to store the image in a separate table and put it on a separate File group.
For more information on file group please consult this link:
The reason behind is that binary large object ( BLOB) may take more than a page to store data.
A “sql data row” is stored sequentially in a page. Storing the BLOB together with text data
might cause database fragmentation.For more information on pages and extent you can refer to this link:
Figure 1. database architecture for storing images
For storing images you have to make use of the varbinary(MAX) datatype. The image datatype will
soon be deprecated
Filestream storage was introduced in SQL Server 2008.
Varbinary(max) can only store images with a maximum size of 2 GB.
With Filestream you can store images larger than 2 GB.
A reference on filestream can be found on this link :
The following link below contains code on how to load Images to SQL server..