SQL Server "AND NOT" operator doesn't work correctly


hi all! try this

select * doc.webdocs contains(*, n'web , not headline')

byt doesn't work.

also try run fts query on machine

don't understand why doesn't work.

Сделаем содержимое сообщества лучше, вместе!

hi yatajga,

from screenshot, found “web” , “headline” keywords in different columns. far know, sql server full-text search search columns 1 one according search condition, rather search column data combination. made example, can refer codes:

use cases; go   create table testandnot ( 	id int, 	headline2 varchar(20), 	webheadline varchar(20), 	constraint pk_test_id primary key (id) ) insert testandnot (id,headline2,webheadline) values (1,'headline 2','web'),(2,'web headline',''),(3,'','headline'),(4,'','web headline'),(5,'','web');   select * testandnot;   create fulltext catalog fulltextcatalog1; create fulltext index on testandnot(headline2,webheadline) key index pk_test_id on fulltextcatalog1;   select * testandnot contains(*,n'web , not headline') /* 1	headline 2	web 5		web */ insert testandnot (id,headline2,webheadline) values (6,'web','headline 2'),(7,'web','headline words') select * testandnot contains(*,n'web , not headline') /* 1	headline 2	web 5		web 6	web	headline 2 7	web	headline words */ -- remove records columns combination meets search condition. select * testandnot contains((headline2,webheadline),n'web , not headline') , not ( 	contains(headline2,n'web') , contains(webheadline,n'headline') ) , not ( 	contains(headline2,n'headline') , contains(webheadline,n'web') ) /* 5		web */ drop fulltext index on testandnot; drop fulltext catalog fulltextcatalog1; drop table testandnot;


allen li
technet community support



SQL Server  >  SQL Server Search



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........