How to store an MS Word doc in a sql 2005 table

  • Hello,

    I want to store the contents of an MS Word document (or a brief Word extract) in a database field. This document could contain carriage returns, boldface, etc.  I have tried storing the Word doc in fields of type nchar, text, and sql_variant but they do not keep the Word formatting. I found that the "Extended Properties" attribute of a field seems to retain these properties. (Though if I recall right, Extended Properties has a length limitation and is a pain in the #*&_*^! to access)

    What is the "right" way to do what I'm trying? Keep in mind that we may want to view this document under either "Query Analyzer" or print a hardcopy version. And we'd like both to be intelligible!

    TIA,

     

    Bill

  • You have quite a mix of terms above.

    Query Analyser is SQL 2000 and below but you mention SQL2005?

    If you are using SQL 2000 try using an IMAGE or VARBINARY fields for storage

    You would have to stream it in and out of the field.

    I don't think that you can view a Word document in Sql Query Analyser

  • Thank You,

    and Yes I do have quite a mix of terms. The intended platform is sql 2005 but how should I refer to that feature of SSMS that one uses to execute queries? (At least under sql 2000 it had a name - Query Analyzer. I don't know what to call it under sql 2005).

    Bill

  • Almost any commonly used expletive will do as a name of SMSS.

  • Have you considered saving the Word docs as RTF text?  Word can save documemtns as "RTF text" and open RTF documents.  However, keep in mind that some of the formatting in Word is not supported in RTF.   We store text in our db as RTF text in "text" fields.  RTF supports the formatting that we need (bold, italics, underline, carriage returns, etc).   We then use a 3rd party control in our in-house application to read the text from the db and display it correctly and allow users to edit it.

    Hope this is helpful.  Good luck!


    Have a good day,

    Norene Malaney

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

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