SEMANTICSIMILARITYDETAILSTABLE
SEMANTICSIMILARITYDETAILSTABLE( table, { column | (column) }, source_key )
Section titled “SEMANTICSIMILARITYDETAILSTABLE( table, { column | (column) }, source_key )”- table: The name of the table from which the semantics similarity details are to be fetched.
- column: The specific column in the ‘table’ parameter whose values are to be compared with the ‘source_key’ to compute semantic similarity. Multiple columns can be passed in a comma-separated parenthesis format.
- source_key: The unique ID of a specific row in the ‘column’ whose semantic similarity is to be compared with other rows.
Example
Section titled “Example”CREATE TABLE TestTable(ID INT PRIMARY KEY, Value NVARCHAR(MAX))INSERT TestTable(ID, Value) VALUES (1, 'This is a test string')
SELECT *FROM SEMANTICSIMILARITYDETAILSTABLE (TestTable, Value, 1)Output
Section titled “Output”+-------+-------------------+-------------------+-------------------+| key | match_rank | matched_by | similarity_score |+-------+-------------------+-------------------+-------------------+| 1 | 1 | This is a | 1.0 || | | test string. | |+-------+-------------------+-------------------+-------------------+Explanation
Section titled “Explanation”Here, we created a table ‘TestTable’ and inserted some data. Using SEMANTICSIMILARITYDETAILSTABLE, we are asking SQL Server to return us semantic similarity details for the document in ‘TestTable’ that contains ‘1’ as its ID. The function returns a table containing detailed information about semantic similarity between the provided document and all other documents in the semantic index. The result will have keys, matched rank, matched by, and similarity score.