I am trying to find the Levenshtien distance between the columns of two different tables TableA and TableB. Basically I need to match ColumnA of TableA with all the elements of ColumnB in TableB and find the Levenshtien Distance
I have created a Levenshtien Function as follows
CREATE FUNCTION [Levenshtein]
(@value1 [NVARCHAR](MAX),
@value2 [NVARCHAR](MAX))
RETURNS [INT]
AS
EXTERNAL NAME [FastenshteinAssembly].[Fastenshtein.Levenshtein].[Distance]
GO
This is basically calling a Levenshtien dll I have on my machine. I tried creating a stored procedure for this operation but I am unsure whether that's an optimized approach or not.
Table B contains millions of CompanyNames and TableA also consists of thousand of CompanyNames so this operation would be essentially a (n*m) operation.
Whats the optimized approach of achieving this.
Thanks