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)
 Full-text index - Result like Google

Author  Topic 

MalteW
Starting Member

4 Posts

Posted - 2011-07-21 : 04:58:01
Hi!

I have a table with a column of the type varbinary. It has a full-text index. The column contains different document types like .docx, .xlsx, .pdf...

The sql query (data is the column containing the document):

select documents.description from documents where contains data, 'something' )

works fine. But how do a get the text from the document where the search word was found, just like google is showing the text under the headline.

/Malte



visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-21 : 05:06:56
you mean you need to retrieve content of doc also in select?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

MalteW
Starting Member

4 Posts

Posted - 2011-07-21 : 05:16:25
quote:
Originally posted by visakh16

you mean you need to retrieve content of doc also in select?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Yes that's right. I need to get the content and if possible only the surrounding text where then search word was found.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-21 : 05:20:31
do you've content also stored in table?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

MalteW
Starting Member

4 Posts

Posted - 2011-07-21 : 05:41:08
quote:
Originally posted by visakh16

do you've content also stored in table?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





No, no extracted data from the documents. if that's what you mean?Only documents stored in the data column. The table look like this:

[id] [int] IDENTITY(1,1) NOT NULL,
[typ] [varchar](50) NULL, -- document typ
[data] [varbinary](max) NULL, --documents stored in this column
[filename] [varchar](250) NULL, --org. filename
[description] [varchar](250) NULL,
[date] [datetime] NULL, --date added to db
[user] [varchar](50) NULL,

/Malte
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-07-21 : 05:44:46
Have you tried FILESTREAM datatype?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

MalteW
Starting Member

4 Posts

Posted - 2011-07-21 : 05:57:40
quote:
Originally posted by SwePeso

Have you tried FILESTREAM datatype?



N 56°04'39.26"
E 12°55'05.63"




I have not, will that solve my problems?

/Malte
Go to Top of Page
   

- Advertisement -