Hi, I was wondering if any SQL Server gurus out there could help me...I have a table I'm trying to apply a full text catalog to, however no results are ever returned due to the text column being cataloged being of varbinary(max) that's being populated from a converted nvarchar(max) value.To re-create the problem quickly...If I populate the column viaCONVERT(varbinary(max), 'test text')then there is no problem, I get results as expected.However if I populate the column viaCONVERT(varbinary(max), CAST('test text' as nvarchar(max)))no results are ever returned.Is this a bug with SQL Server 2005 Full Text Indexing? I'm happily creating full text catalogs when an nvarchar is not getting converted into a varbinary.I'm setting the Document Type column to '.html' (I've tried changing this to '.txt' in case it was a fault with the html ifilter but the problem persists so I believe I can rule this out).The reason I need to convert an nvarchar to varbinary is that the table holds multi-lingual text and I'm adding a html meta tag <META NAME="MS.LOCALE" CONTENT="ES"> to the beginning in order for the full text indexing word breaker to select the correct language to catalog the text with. The aim being to provide more relevant searches in users native languages (I've read a few articles that describe this technique, but it's the first time I've tried to apply it).Any pointers / suggestions would be greatly appreciated. Cheers,Gavin.Below is a T-SQL script you can run to demonstrate the effect I'mexperiencing...-- Create test databaseCREATE DATABASE FullTextTestGOUSE FullTextTestGO-- Create test data tableCREATE TABLE TestTable(pk UNIQUEIDENTIFIER NOT NULL CONSTRAINT tablePK PRIMARY KEY,varbinarycol VARBINARY(MAX),documentExtension VARCHAR(5),)GO-- The below single entry WILL BE FOUND (the text source is being entereddirectly)INSERT INTO TestTable (pk, varbinarycol, documentExtension) VALUES (NEWID(),CONVERT(VARBINARY(MAX),'<META NAME="MS.LOCALE" CONTENT="EN">test entry 1'),'.html')-- The bellow two entries below WILL NOT BE FOUND (the text source is takenfrom an NVARCHAR(MAX) value)INSERT INTO TestTable (pk, varbinarycol, documentExtension) VALUES (NEWID(),CONVERT(VARBINARY(MAX), CAST('<META NAME="MS.LOCALE" CONTENT="EN">test entry2' AS NVARCHAR(MAX))), '.html')INSERT INTO TestTable (pk, varbinarycol, documentExtension) VALUES (NEWID(),CONVERT(VARBINARY(MAX), CAST('<META NAME="MS.LOCALE" CONTENT="EN">test entry3' AS NVARCHAR(MAX))), '.html')GO-- Create the full text catalogsp_fulltext_database 'enable'GOCREATE FULLTEXT CATALOG TEST AS DEFAULTGOCREATE FULLTEXT INDEX ON TestTable (varbinarycol TYPE COLUMNdocumentExtension LANGUAGE 1033)KEY INDEX tablePKGO-- NOTE: You might need to give the catalog a chance to build before runningthe script below.-- Now do a search that SHOULD RETURN 3 ROWS of data, but ONLY 1 ROW ISRETURNEDSELECT CAST(varbinarycol AS NVARCHAR(MAX)) FROM TestTable WHERECONTAINS(varbinarycol, 'test')
www.gavinharriss.com