Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Document search with Full-Text

Posted on 2004-10-20
4
Medium Priority
?
254 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

730 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