1

I have to display images on website and I can store image in the folder on my website and also I can store the image in image column of SQL Server. So which way of storing image is better : in folder or in Image column of SQL Server. 1. Which way of storing image and retrieving it is faster

  • 2
    You could also consider `FileStream` as you are on SQL Server 2008. This stores the images on the File System but has integration with the database for backups etc. – Martin Smith Jan 22 '12 at 14:10
  • possible duplicate of [Storing a file in a database as opposed to the file system?](http://stackoverflow.com/questions/8952/storing-a-file-in-a-database-as-opposed-to-the-file-system) – Martin Smith Jan 22 '12 at 14:12

2 Answers2

2

With SQL Server 2008, while you can store BLOB data, it's best to avoid it. I've done it in the past, grudgingly, and it did have negative performance implications. Unless you have some constraint which prevents it, use the file system. That's what it's built for, and it's much faster.

Sean H
  • 736
  • 6
  • 9
2

As @Martin Smith pointed out you could use FileStream. We started storing our files using FileStream so that we could also add full-text indexing and allow the users to not only search the data, but the files on our site. It is also nice because we can easily move our files along with teh Database to other environments (Dev, Test).

nice file stream Article: Here

Also, please use varbinary(max) if you are going to store in the DB. The image column is going to be deprecated in future versions.

--S

scarpacci
  • 8,957
  • 16
  • 79
  • 144