Full-text index image column, Raiders

xiaoxiao2021-03-06  21

Full-text index image column, all Raiders!

Author:

Game.19xz

source:

19xz.com

Today, I've lost the power outage of "100 years" and read a day. In the evening, I made a full-text index. I decided to put my experience. I tried to write more, everyone learned together, welcome to correct! 1. Start the Microsoft Search service start menu -> SQL program group -> service manager -> drop basket -> Microsoft Search Service -> Start it 2, ../microsoft SQL Server / MSSQL / FTDATA / SQLSERVER The / config / directory built a non-empty NOISE.chs file non-empty NOISE.chs file, and some people say that it is empty noise.chs file, but I wrote a few a few letters that are not used each time.

3. Establish an environment to open the query analyzer -> Execute the following scripts: ---------------------------------- -------- Create Database Test --- Create Test Database Use Test --- Select Test Database Create Table Dali (ID INT Not Null Primary Key, MyImage Image, Filetype Varchar (255), FileNMAE VARCHAR (255 ) --- Create a Dali Table - Dali Table ID, MyImage, FileType three columns is necessary, because you want to have an image column index, you must have a primary key column, an image column, a column that stores file types - - We know that the file type in the Windows system is distinguished by the expansion, so the filetype column is also the extension of the file -------------------- --------------------- sp_fultext_database 'enable' - Enable database sp_fulltext_catalog 'my_fulldir', 'create' --- creation of MY_FULLDIF for full-text index Directory 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_fultext_table 'dali', 'create', 'my_fulldir', @ key ---- This two sentences are for full-text indexes, tag sp_fulltext_column ' Dali ',' MyImage ',' add ', 0x0804,' filetype '--- This sentence is the specified MyImage list as a full-text search, FileType is the type column ---------------- ------------------------------ 4, put an extension called DOC in the C drive, an extension Excel file for XLS, an extension A web file called HTM, 4 pictures called BMP, you can put it according to the actual situation! 5, insert the data to establish the following stored procedures --------------------------------------- --------- Create Procedure SP_TextCopy @srvname Varchar (30), @login varchar (30), @Password varchar (30), @dbname varchar (30), @tbname varchar (30), @colname varchar (30), @filename varchar (30), @whereclause var (40), @direction char (1) AS / * This is to insert files into the database using the TextCopy Tool, if there is a front tool to use the front desk development tool to file files Insert, here for demonstration * / declare @exec_str varchar (255) SELECT @ EXEC_STR = '

TextCopy / S ' @ srvname ' / u ' @ login ' / p ' @ dbname ' / t ' @ tbname ' / c ' @ colname ' / w "@ WHERECLASE '"/ F"' @ filename '"/' @ DirectionExec Master..xp_cmdshell @exec_STR -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------ Insert Dali Values ​​(1,0x, 'doc', 'strong DOC') --- The second column is 0x It is a 16-based number corresponding image column, it is necessary, don't write null, the third column is the file type, extension sp_textcopy 'your server name', 'sa', 'your password', 'Test ',' dali ',' myimage ',' c: / vigorous doc.doc ',' where id = 1 ',' i '------- the parameter is: instance name, user name, password, Database name, table name, image column name, path and file name, condition (you must guarantee that it only chooses a line), i ----------------------- -------------------------------------------------- ------------------------------------------- Insert Dali Values ​​(2, 0x, 'bmp', 'picture') sp_textcopy 'Your server name', 'sa', 'your password', 'Test', 'Dali', 'MyImage', 'C: / Picture .BMP', ' WHERE ID = 2 ',' I '- Note Condition is ID = 2 Insert Dali Values ​​(3,0X,' XLS ',' Excel File ') sp_textcopy' Your Server Name, 'Sa', 'Your Password ',' Test ',' Dali ',' MyImage ',' C: / Excel File .xls', 'Where Id = 3', 'I' - Note Cat Information is ID = 3 Insert Dali Values ​​(4,0x, 'htm', 'page') sp_textcopy 'Your server name', 'sa', 'your password', 'Test', 'Dali', 'MyImage', 'C: / Web .htm', 'Where Id = 4 ',' I '- Note The condition is ID = 4 ---------- The above statement, to ensure the type, the path is correct, the condition should be 6, fill full-text index sp_fulltext_table' Dali ','

转载请注明原文地址:https://www.9cbs.com/read-70445.html

New Post(0)