SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

cstokes91
Yak Posting Veteran

USA
60 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)?

robvolk
Most Valuable Yak

USA
15683 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

visakh16
Very Important crosS Applying yaK Herder

India
52325 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

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 - 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  
 New 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.06 seconds. Powered By: Snitz Forums 2000