Friday, February 24, 2012

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,

Barkingdog

hello,

looks like an EDMS to me

1. you have to OCR(optical character recognition) the document to obtain the text content

that you want to view in sql query analyzer. OCR is a free feature of msoffice 2003.

2. Or. run an application that do office automation and read the text line by line.Save it as a string

then save to sql server. that is if you dont trust the OCR

3. to keep the document intact as it is. Save the document as a doc file then stream it in to a

sql server blob data type

4. stream out the doc and open it with msoffice when you want to view it.

5. you may want to apply fulltext feature on the result of no 1 and 2

regards,

|||In comment to joey, I would recommend the 3 +4 as you can store the data as a Blob and enable SQL Server to use fulltext search on that blob with the appropiate settings. You wont′need to store the data in "cleartext", binary will be enough to enable full-text capability.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

i see.

they need to read the docs through QA so i recommended an OCR

to store clear text.

thanks for the comment anyway

|||You are right, seems that I didnt′read that part in detail:-)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment