ahmed salah

ahmed salah

  • 1.1k
  • 659
  • 41.9k

How to add Percentage of similar compare two string ?

Nov 2 2022 3:40 AM

I work on sql server 2019 i have issue i can't get percentage of two string from table

so i will compare between two string columns (PartText,MaskText)

and i will display similar percentage of two column

so as sample 'TR00123907FG','KB00123907FG' two string different only on first two charachters

so difference will be 80 percent

 

 create table #compareTextPercentage
 (
 PartText varchar(50),
 MaskText varchar(50)
 )
 insert into #compareTextPercentage(PartText,MaskText)
 values
 ('TR00123907FG','KB00123907FG'),
 ('TR00123907FG','TR00123907FG'),
 ('klmhedf43122','50ghlpnkyzhy')

 


Answers (1)