Solved

Document search with Full-Text

Posted on 2004-10-20
4
251 Views
Last Modified: 2006-11-17
hi,

I need little more details on following SPROC

sp_fulltext_column
    [ @tabname = ] 'qualified_table_name' ,
    [ @colname = ] 'column_name' ,
    [ @action = ] 'action'
    [ , [ @language = ] 'language' ]
    [ , [ @type_colname = ] 'type_column_name' ]


I've covered Full-Text Search and I'm pretty familiar with it by now what I don't get is this


[@type_colname =] 'type_column_name'
Is the name of a column in qualified_table_name that holds the document type of column_name. This column must be char, nchar, varchar, or nvarchar. It is only used when the data type of column_name is an image. type_column_name is sysname, with no default.



this got me really confused, ok I know the theory now, but I need to see it in action I mean how can I create table where I can store [.xls, .doc, .pdf, .txt, .html] type files and then use Full-Text Search to search within this documents..?


thank you
 dave



0
Comment
Question by:davidlars99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
eclipse2k earned 500 total points
ID: 12359247
Hello dave,


i guess you need to add an additional column to your table.
i am really not sure, but try this..:

Create a Table (Name: mytable) with the Columns:

id (int, primary key, identity)
content (varbinary???)
ctype (varchar(4))


then put the binary data of a word document into column 'content'
and set ctype in that row to '.doc'

then call:

sp_fulltext_column @tabname='mytable', @colname='content', @action='Add', @type_colname='ctype'


i guess this could work.
now you should be able to find any words of the DOC using the Contains() Expression



http://msdn.microsoft.com/library/en-us/tsqlref/ts_sp_fa-fz_8sz2.asp
http://msdn.microsoft.com/library/en-us/tsqlref/ts_ca-co_2y2h.asp



eclipse2k
0
 
LVL 13

Author Comment

by:davidlars99
ID: 12359682
briliant!!!

can you take a look at this question as well please
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21175532.html
0
 
LVL 13

Author Comment

by:davidlars99
ID: 12360267
let me ask you two simple questions,

1) when you pull the contet out from that column (using serverside script like ASP) and present it within HTML is it gonna loose its format?

2) how would you update the data within that document after it was stored in the database?

0
 
LVL 4

Expert Comment

by:eclipse2k
ID: 12361851
hi,

1) when you pull out the content out of the Data (image) column, you won't lose the format

2) i guess, simply overwrite the complete document in that column by using UPDATE. if update is not working, you probably will need to use a combination of TEXTPTR() and READTEXT()

Example
----------------------------
USE pubs
DECLARE @val varbinary(16)
SELECT @val = textptr(pr_info) FROM pub_info
WHERE pub_id = '0736'
READTEXT pub_info.pr_info @val 4 10
----------------------------

Reference: http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21175532.html


i read http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21175532.html and i dont have much more to say then some people said already
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question