I have set of records which I need to search using criteria. But criteria is returning me multiple rows.
So I need top 2 records which are having maximum percentage
As far as I understand you need something like Fuzzy String Matching using Levenshtein Distance Algorithm. Hope the link will be helpful.
You need to calculate distance between CountryName and search pattern. It's not exactly the "percentage", but it can measure the relevance.
Maybe this solves your problem?
SELECT TOP 2 FirstName, LastName, CountryName, StateName
FROM Employee
WHERE
statename like '%Gujarat%' AND countryname like '%India%'
ORDER BY
dbo.edit_distance(statename, 'Gujarat') + dbo.edit_distance(CountryName, 'India') DESC