SQLserver2008 全文 检索 使用 方法 1. 开启SQL Full-text服务 图1 开启 SQLServer Full-text服务 保证 SQL Full-text Filter Daemon Launcher服务处于开启状态,不同版本SQLServer 全文 检索 服务名称可能稍有不同,如果服务列表中没有这个服务,请 使用 SQ
SQLserver2008全文检索使用方法
1. 开启SQL Full-text服务
图1 开启 SQLServer Full-text服务
保证 SQL Full-text Filter Daemon Launcher服务处于开启状态,不同版本SQLServer全文检索服务名称可能稍有不同,如果服务列表中没有这个服务,请使用SQLServer安装光盘安装“全文检索”组件。
2. 启用全文检索
执行SQL语句启用全文检索:
Execute sp_fulltext_database 'enable'
3. 设置全文语言为中文
图2 设置全文语言
在服务器->属性->高级中,设置默认全文语言为2052(中文)。
4. 建立数据表
在需要全文检索的数据表中,必须有一列字符型的字段存放文件类型,例如建表语句中的FileType。必须有一列Varbinary(Max)类型的字段存放文件内容,例如建表语句中的FileContent。
建表SQL语句示例:
CREATE TABLE SampleBlobTable
(
[PKID] int identity(1,1) primary key,
[FileName] Nvarchar(255) null,
[FileType] Nvarchar(32) null,
[FileContent] VARBINARY(MAX) NULL,
[AddTime] datetime default(getdate())
)
5. 建立全文索引
步骤1 建立全文索引
在需要全文检索的数据表上点击右键->全文索引->定义全文索引。
步骤2 选择唯一索引
步骤3 选择表列
选择表列,本例中以FileType列标明文件格式,将文件存入数据库时须正确填写此字段,此字段中的数据内容包括“doc”、“txt”、“xls”等。
后续步骤无需更改默认值,点击下一步继续直至完成。
6. 支持PDF文件
1. 安装 Adobe iFilter
Adobe iFilter6.0:
http://www.adobe.com/support/downloads/thankyou.jsp?ftpID=2611&fileID=2457
Adobe iFilter9.0 for 64bit:
http://www.adobe.com/support/downloads/thankyou.jsp?ftpID=4025&fileID=3941
2. 执行SQL语句
exec sp_fulltext_service 'load_os_resources', 1;
exec sp_fulltext_service 'verify_signature', 0;
3. 重新启动 SQLSERVER
4. 检查支持文件
执行下列语句:
select document_type, path from sys.fulltext_document_types where document_type = '.pdf',如查询结果为下图则表示成功,可以进行PDF的全文检索了。
l
图3 执行结果
7. 查询语法及示例
5. 语法
CONTAINS
<strong>( </strong>
{
column |
* }
, ''
)
::=
{
|
|
|
|
}
| {
<strong>( </strong>
)
{ AND | AND NOT | OR } [ ...
n ]
}
::=
word |
" phrase "
::=
{
"word * " |
"phrase *
" }
::=
FORMSOF ( INFLECTIONAL , [ ,...
n ] )
::=
{ | }
{ { NEAR | ~ } { | } } [ ...
n ]
::=
ISABOUT
<strong>( </strong>
{{
<simple_term></simple_term>
|
|
|
}
[ WEIGHT
<strong>( </strong>weight_value ) ]
} [
,...
n ]
)
6. 示例
- 查找文件内容含“合同”的数据。
select * from SampleBlobTable where contains(filecontent,'合同')
注意:如果查询条件中包含空格,查询条件需用双引号括起来,如'”合 同”',否则视为语法错误。
- 查找文件内容含“归档”或“标题”的数据。
select * from SampleBlobTable where contains(filecontent,'归档 OR 标题')
注意:多个词之间用逻辑操作符连接 (包括 AND ,AND NOT,OR )。如果词中包含空格,那么这个词要用双引号括起来。
- 查找文件内容含“北京?站”的数据。
select * from SampleBlobTable where contains(filecontent,'北京Near 站')
注意:上述SQL语句将返回包含“北京站”、“北京西站”、“北京东站”等“北京”与“站”无间隔或间隔一个汉字(如果是英文则为一个单词)的数据,不会包含“北京东南站”的数据。
- 查找所有开头字母为”hu”的数据。
select * from SampleBlobTable where contains(filecontent,'hu*')
注意:上述SQL语句将返回包含”human”、”hungry”等单词的数据,此语法只针对英文有效,针对中文“*”符号无论有无,效果均相同。
- 加权查询
select * from SampleBlobTable where contains(filecontent,'ISABOUT (city weight (.8), county weight (.4))')
注意:上述SQL语将将针对city和county两个词进行不同权重的查询,权重不同将影响返回数据集的显示顺序(如果限定返回数量,则间接影响是否返回数据)。
- 多态查询
select * from SampleBlobTable where contains(filecontent,'FORMSOF (INFLECTIONAL,dry)')
注意:查询将返回包含”dry”,”dried”,”drying”等数据,针对英语有效。

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Notepad++7.3.1
Easy-to-use and free code editor