SQL SERVER – Do Not Store Images in Database – Store Location of Images (URL)

My advice is simple: do not store images in database tables, store their location. Just a day ago I received phone call from my friend in Bangalore. He asked me

SQL SERVER - Do Not Store Images in Database - Store Location of Images (URL)

What do I think of storing images in database and what kind of datatype he should use?

I have very strong opinion about this issue.

I suggest to store the location of the images in the database using VARCHAR datatype instead of any BLOB or other binary datatype.

Storing the database location reduces the size of database greatly as well updating or replacing the image are much simpler as it is just an file operation instead of massive update/insert/delete in database.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

Database, SQL String
Previous Post
SQL SERVER – Q and A with Database Administrators
Next Post
SQL SERVER – TempDB Restrictions – Temp Database Restrictions

Related Posts

56 Comments. Leave new

  • please ,how i can upload pdf file from client to wamp server then store the path of file ??

    Reply
  • please ,how i can upload pdf file from client to wamp server then store the path of file ?? i use c# language by visual studio 2010

    Reply
  • If i store image in database using varchar then what is the use of image datatype……

    thanks in advance

    Reply
    • Try to refrain away from Image datatype, it is obsolete now. If you want to store image or blobs inside SQL Server – try to use VARBINARY(MAX) datatype.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.