views:

177

answers:

2

I'm using MS SQL 2008 server, and I have a column that stores a word document ".docx".

Within the word document is a definition (ie: a term). I need to sort the definitions upon returning a dataset.

so basically...

SELECT * FROM DocumentsTable Order By DefinitionsColumn ASC.

So my problem is how can this be accomplished, the binary comlumn only sorts on the binary value and not the word document content?

I was wondering if fulltext search/index would work. I already have that working, just not sure if I can use it with ORDER BY.

-Thanking all in advance.

+1  A: 

I think you'd need to add another column, and populate this with the term from inside the docx. If it's possible at all to get SQL to read the docx (maybe with a custom .net function?) then it's going to be pretty slow.

Better to populate and maintain another column.

Andrew M
Thanks Andrew, that is what we were thinking.
DooMer
Cool :) Glad to help.
Andrew M
A: 

You have a couple options that may or may not be acceptable.

  1. store the string definition contents of the file in a field along side the binary file column in the record.

  2. Only store the string definition in the record, and build the .docx file at runtime for use within your application.

Matthew Vines
Yeah I'm leaning towards the extra field. Thanks Matthew
DooMer