We needed to find related words using the SQL Server FORMSOF function. Although it is used mainly to find related words in bodies of text, we wanted to use it to find related words in a table of just words. Initial approaches focused on finding a SQL Function or table that contained the database of related words. This turned out to be a dead end.
We decided a clever approach would be to iterate through each row of the table, using it to query all the rows. This would create groupings of words that could be used to tie them together, via a common group ID.
Although a better solution may have been to use a indexing engine such as Lucene to generate the correspondences, we were already using SQL Server’s functions.