Solved

Document search with Full-Text

Posted on 2004-10-20
4
247 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
  • 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now