Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Phonetic Function

Author  Topic 

pravin14u
Posting Yak Master

246 Posts

Posted - 2007-07-22 : 07:18:18
Hi All,

Is there any function which will return "MATCH PERCENTAGE"?

For Example, Function("United","Unitd") should return 99% or so based on how close the strings match.

I tried Difference(string1,string2) which returns only values between 0 and 4 (inclusive). I need to get a percentage.

Thanks,

Prakash.P

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-22 : 08:56:22
Yes. Divide the number from the Difference function with 4!

SELECT Difference(string1,string2) / 4.0

That will give you 0.0%, 25.0%, 50.0%, 75,0% and 100.0%


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-07-22 : 09:35:20
This method returns a value between 0 and 100 indicating the similarity of two different strings:
http://sqlblindman.googlepages.com/fuzzysearchalgorithm
Is is not an actual "percentage", but rather and arbitrary rating. I don't know how you would define the problem narrowly enough to get a true percentage.

e4 d5 xd5 Nf6
Go to Top of Page
   

- Advertisement -