Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Document search with Full-Text

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

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

927 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