Full-Text Search
Collation of Full-text Search: 1. Start Microsoft Search service Start menu-->sql program Group--> Service Manager--> dropdown basket-->microsoft Search service--> start it ---is usually started in the service. 2. .. \microsoft SQL Server\mssql\ftdata Qlserver\config\ directory to build a non-empty noise.chs file non-empty noise.chs file, but also some people say that the Noise.chs file is empty. -Typically, this folder is already 3 by the document and document content. Setting up the Environment Open Query Analyzer--> execute the following script: -------------------------------------------- CREATE DATABASE test---Creating test databases use test ---Select Test database create table dali (ID int not null primary key,myimage Image,filetype varchar ( 255),filenmae varchar (255))---Create Dali table --dali table Id,myimage,filetype Three columns are required, Because to index an image column, you must have a primary key column, a image column, a column that holds the file type sp_fulltext_database ' Enable '--enable the database for Full-text indexing sp_fulltext_catalog ' my_fulldir ', ' create ' ---Create a full-text catalog called My_fulldif declare @Key sysnAme; Select @Key =c.name from syscolumns a,sysconstraints b,sysobjects C where a.id=object_id (' Dali ') and a.name= ' id ' and a.id=b . ID and B.constid=c.id and c.name like ' pk% ' exec sp_fulltext_table ' Dali ', ' Create ', ' My_fulldir ', @Key ---- These two sentences are for full-text indexing, to mark a table
Sp_fulltext_column ' Dali ', ' myimage ', ' Add ', 0x0804, ' FileType ' ---this is to specify that the MyImage is listed as a full-text indexed column, FileType is type column 4, INDEX.HTML5 a Web page file with an extension of HTM on the C disk. Insert data Create the following stored procedure--------------------------------------------------create PROCEDURE sp_textcopy @srvname varchar (, @login varchar (), @password varchar (, @dbname varchar (), @tbname varchar (, @colname varchar (), @filename varchar ( , @whereclause varchar, @direction CHAR (1) as/* This is the use of the Textcopy tool to insert files into the database. If a foreground tool can be used to insert a file in the foreground developer tool, here to demonstrate the */declare @exec_str varchar (255) SELECT @exec_str = ' textcopy/s ' + @srvname + '/u ' + @login + '/ P ' + @password + '/d ' + @dbname + '/T ' + @tbname + '/C ' + @colname + '/w ' + @whereclause + ' "/F" ' + @filename + ' "/" + @directionEXEC Master.. xp_cmdshell @exec_str6. Insert Dali values (1,0x, ' htm ', ' web ') Sp_texTcopy ' Gaolong ', ' gaolong1 ', ' 831001 ', ' Test ', ' Dali ', ' myimage ', ' c:\index.html ', ' where id=1 ', ' I ', in turn, are: server name (not instance name), User name, password, database name, table name, image column name, path and filename, condition (you must make sure that it selects only one line), here are the common problems: (1) results show output ' textcopy ' is not an internal or external command, nor a running program or batch file. null Solution: Copy Textcopy.exe to C:\Program Files\Microsoft SQL Server\mssql\binn directory: C:\ Program Files\Microsoft SQL Server\80\Tools\Binn (2) results show db-library Error 10004: Unable to connect: SQL Server is unavailable or does not exist. The specified SQL Server was not found. Error:could not connect to SQL Server ' PR ' solution: The server's relevant landing parameters are not correct, can be adjusted according to the actual situation. 7. Populate Full-text indexing sp_fulltext_table ' Dali ', ' start_full ' 8. Test select * from Dali where contains (MyImage, ' title ')
This is done in Query Analyzer, there are other ways to operate: 1, open the Northwind database, right-click the Products table, select "Full-text index table", "define Full-text Index on the table", create a Full-text catalog for it. In the Full-Text Indexing Wizard, select the columns (which can be text or images) where you want the Full-text query criteria, and we select ProductName and QuantityPerUnit columns. Then next, enter a new directory Procatalog and click Next. In the fill schedule, we do not establish a fill schedule for the moment. Next, complete the Full-text Indexing Wizard. When we are done, we can see that we have a Full-text catalog procatalog in the Full-text catalog. Right-procatalog property, you can see its status, table, scheduling situation. 2, right key Full-text catalog Procatalog, "Start Full Population", the system will appear "full-text catalog population started successfully". 3, at this time, we can use Transact-SQL for Full-text search, we use contains, FREETEXT and other predicates.
This data is collated from: http://www.haihua.net/hhwwview.asp?id=133 and http://www.jaron.cn/chs_db/20/2003-11/20031102002340-101385.html
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.