Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Provided Answers: 4

    Unanswered: storing files in the database or outside

    We had a discussion about where to store files (Word, PDF, ...) - that are generated by an application or from external sources - in or outside the database.

    I once had to develop an application on an unstable environment where we had to do frequent restores (at least once per month) due to power and hard disk problems. My first version stored the files on the file server. But the clean up headache (synchronising the data in the database with the files on the file server) after each restore drove me to store the (zipped) files in the database. I had the guarantee that after the restore the database and the files were in sync. No more headaches.

    Now things have changed. That unstable system is replaced by ever better systems and I wonder what the best practice is to store the files generated or related to a database application. I think the best place to store files is in a file server, but I wonder how one has to deal with the synchronisation problem after a restore.
    With kind regards . . . . . SQL Server 2000/2005/2012

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  2. #2
    Join Date
    Apr 2008
    Iasi, Romania
    Provided Answers: 2
    For MSSQL 2008, you may take a look at FILESTREAM.
    Also, read this:
    Storing Images and BLOB files in SQL Server – Database Journal
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Jan 2003
    Nottinghamshire, UK
    SQL Server is not optimized to be a File Server - It's a Database - Full Stop

    Do not put BLOB's into the DB unles you ABSOLUTELY have to is the Best Practice.

    CMDExec within an SP gives you access to do DIR lists etc - Store File Names in tables instead - StoreFilepaths in a parent table so they're easy to alter if neccesary.

    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts