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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Microsoft Word (.doc) to varchar(max)
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

72 Posts

Posted - 08/20/2013 :  16:15:44  Show Profile  Reply with Quote
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)?

Most Valuable Yak

15732 Posts

Posted - 08/20/2013 :  20:11:27  Show Profile  Visit robvolk's Homepage  Reply with Quote
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

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 08/21/2013 :  00:49:48  Show Profile  Reply with Quote
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


SQL Server MVP
Go to Top of Page

Aged Yak Warrior

940 Posts

Posted - 08/21/2013 :  09:01:31  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000