May 6, 2012 at 7:07 am
I would like to retrieve all of the document pairs from a fulltext semantic index. Why does the query below generate a syntax error in SQL Server 2012
CREATE table tbl (ID int primary key, txt nvarchar(max));
CREATE FULLTEXT INDEX ON tbl(txt STATISTICAL_SEMANTICS) KEY INDEX tbl_fulltext_index;
SELECT count(*)
FROM tbl
CROSS APPLY SEMANTICSIMILARITYTABLE(tbl, txt, tbl.ID)
If I create a wrapper function
CREATE FUNCTION SST(@ID int)
RETURNS @SS table (
srcColint,
matchColint,
matchDocint,
scorefloat
)
AS BEGIN
INSERT INTO @SS(srcCol, matchCol, matchDoc, score)
SELECT source_column_id, matched_column_id, matched_document_key, score
FROM SEMANTICSIMILARITYTABLE(tbl, txt, @ID)
RETURN
END
then the query below is acceptable syntax and executes
SELECT count(*)
FROM tbl
CROSS APPLY dbo.SST(tbl.ID)
The wrapper function lets me do what I want to do, but I am curious about what is wrong with the original query.
May 15, 2012 at 11:31 pm
Try the following
SELECT count(*)
FROM tbl
CROSS APPLY SEMANTICSIMILARITYTABLE(tbl, txt, tbl.ID) a
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply