Solved

Document search with Full-Text

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
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.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

623 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