Saving a file directly to database?

  • Is it possible to store a file in a binary field in SQL, then user can access it normally (with MS Word). When user click on Save, the file is saved directly back to the database?

    What will happen is:

    1) User click a button in an application (can be a web page).

    2) Application retrieve the file from database, and open it in MS Word.

    3) User works on the file.

    4) User click Save in MS Word, and the new copy is saved directly to the database. The application that was used to access the file is bypassed.

    SharePoint currently does that, my question is is there anyway to mimic that behaviour?

  • Sure, Sharepoint writes it up to a varbinary data type and you can do the same. You just have to take into account that you need to stream that data in & out if it's beyond 4000 characters in length. I don't like to encourage it. If anything, I'd suggest moving to 2008 and taking advantage of FileStream which means you won't have to store the data in the database, but can still maintain integrity. That's what we're moving to with 2008 R2 and SharePoint 2010.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply