How can i search for a string value in a sql server varbinary column

I want to have a power search facility in my application.
I am storing doc files in a varbinary(max) column in sql server 2005 database.
Can i compare a string value passed from the front end to the sql server and check whether the doc file stored in the binary format in the database contains the passed string.
SukeshjphAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteveH_UKCommented:
The doc files cannot be searched directly.  You need to create a full text index on the table.

See http://msdn2.microsoft.com/en-us/library/ms142497.aspx.
0
SukeshjphAuthor Commented:
Can i accomplish my task  any other way...because i don't have permission to do indexing in my database...can i convert the string to byte array and have a search in the varbinary column in the sql server database...
0
SteveH_UKCommented:
Not for searching within a .DOC file.  The content is encoded.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

SukeshjphAuthor Commented:
I enabled the full text search in my  varbinary(max) column now what is the next step to search the passed string in the .doc file stored in this column.
0
SteveH_UKCommented:
OK.  So once you have the index created (and you have configured the table with a column indicating the file extension, in this case .doc), you can use this command:

SELECT [YourColumn] FROM [YourTable]
WHERE CONTAINS (YourVarBinary, ' "word pattern" ')

See these references:
http://msdn2.microsoft.com/en-us/library/ms142531.aspx (Query varbinary(max))
http://msdn2.microsoft.com/en-us/library/ms142559.aspx (Full text queries)


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveH_UKCommented:
Thanks for the points :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.