How to save word document in sql database?



    Hi all,

    I have created a word document in my application (.Net). How can I save the word document (containing tables and some HTML formats) in a database and retrieve it for later use?

    Thank you in advance,

    Thursday, December 27, 2007 5:21 PM


All replies


    Why do you want to save it as a table?


     From what you described you have created a document with some notes.

     If it is just a referance of sorts it seems to me it would be okay to store it outside of sql - or to drill down into the sql program file and store it with the sql program.


    I think that the database it self will only store tables.....


    Another thought....Are you trying to save the document to use as a stored proceedure?????


    Are you looking to save it as an image?




    Saturday, December 29, 2007 3:27 PM
  • While it's possible to store a Word Document (.doc or .docx) file in the database as a Binary Large Object (BLOB) using an IMAGE or VARBINARY(MAX) typed column, I rarely recommend this approach. It is more complex to do so, there are a number of special issues to deal with and it does not perform particularly well. It usually makes more sense to store the PATH to the document file in the database and use the Windows file system to store and retrieve the data as needed.  


    Sunday, December 30, 2007 8:27 PM
  • Here is a thread which may be of use:



    While William may have some valuable points regarding performance, i can see merit in storing all your data together for simplicity of backup. Its also worth noting that SQL2008 has a new FILESTREAM attribute which bridges the gap between the filesystem and database.



    Wednesday, January 02, 2008 10:27 AM
  • rich - it seems the link is broken. Could you suggest any other source for the same.
    Friday, September 03, 2010 5:47 PM