Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Microsoft Word (.doc) to varchar(max)

Author  Topic 

cstokes91
Yak Posting Veteran

72 Posts

Posted - 2013-08-20 : 16:15:44
Okay... before you see this and immediately say that varbinary is better... I know and wish that was an option. I am trying to insert a clients word documents into a database to be able to be viewed from our application (not an option to modify the application for this situation either)... the only field that would work (if it is even possible) is a varchar(max).

Is there ANY way to convert and get the text from a Microsoft Word document to varchar(max)?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-08-20 : 20:11:27
Probably not, since Word contains binary information along with the text. If you did import it to varchar(max), it will either get dropped or garble the data.

I would almost say that filestream might work here, but I'm pretty sure that only works for varbinary(max) as well.

If you're a masochist, you can write some VBA macros in Word that opens the document, extracts just the text info, and then imports that into a database. Frankly you're far better off changing the column to varbinary(max).
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-21 : 00:49:48
If you've any plans of moving to SQL 2012, you could use a filetable for storing all kinds of documents. it corresponds to a folder in the file system

see

http://visakhm.blogspot.in/2012/07/working-with-filetables-in-sql-2012.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2013-08-21 : 09:01:31
Word docs are just ZIP compressed XML. You may be able to use that to your advantage. It's either that or convert to Base64 :(
Given that it's "our application" it's silly you can't do this properly (blob/varbinary) because ultimately it's only you that has to deal with it.
Go to Top of Page
   

- Advertisement -