I am currently trying to add a FULLTEXT Index to be able to search for key words in a narrative column which contain key words. I have tried many different tutorials and although I copy them exactly I am unable to replicate the results when using the 'CONTAINS' feature in the 'WHERE' section.
Below is a example of my script that I have been using with some example data. Would someone be able to explain to me why this is not working, as I am seriously struggling to see where the error may lie.
CREATE TABLE dbo.AAAA_FullTextTest5
(ID INT Identity(1, 1) NOT NULL
,LOCATION VARCHAR (255)
,NARRATIVE VARCHAR(MAX)
)
ALTER TABLE dbo.AAAA_FullTextTest5 add constraint PK_FullTextTest5 PRIMARY KEY (ID)
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('USA Texas', 'WRIGHT BROTHERS')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Worldwide', 'CROWN PROS Builders LTD')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Devon United Kingdom', 'J PJH ROOFING LTD')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('UK', 'Shoreham Port Authority and Shoreham Port Developments & The Port of Shoreham Trustees ')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('EUROPE AND RUSSIA', 'ZHY SERVICES')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Austrialia', 'BrotherLimited')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('ASIA', 'DRILLING SERVICES LTD')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('JAPAN', 'BROOKS WASTE LTD')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Melbourne', 'TRC Service Company')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('GERMANY & HOLLAND', 'Samson Group')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Frankfurt', 'SCAFFOLDING LTD')
INSERT INTO dbo.AAAA_FullTextTest5 (LOCATION, NARRATIVE) VALUES ('Swindon, England', 'Scaffold Access Ltd')
CREATE FULLTEXT CATALOG FullTextTest5
CREATE FULLTEXT INDEX ON dbo.AAAA_FullTextTest5 (
Location language 1033
,Narrative language 1033)
KEY INDEX PK_FullTextTest5 ON FullTextTest5
WITH CHANGE_TRACKING AUTO
SELECT * FROM dbo.AAAA_FullTextTest5
WHERE CONTAINS(NARRATIVE, 'Access')
Based on the instructions here: https://msdn.microsoft.com/en-us/library/ms142497.aspx, the following appears to work properly in my local installation of SQL Server 2008 R2, as well as my local installation of SQL Server 2012:
With the above setup in place, I can then query:
And get this result set: