clear markdown compare help best fiddles feedback
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2805432 fiddles created (40862 in the last week).

DECLARE @Str1 VARCHAR(45) = 'Interesting', @Str2 VARCHAR(45) = 'Interested'; WITH CTE AS ( SELECT 1 Num UNION ALL SELECT Num + 1 FROM CTE WHERE Num < (SELECT CASE WHEN LEN(@Str1) > LEN(@Str2) THEN LEN(@Str1) ELSE LEN(@Str2) END) ) , F AS ( SELECT *, @Str1 Str1, @Str2 Str2, CASE WHEN SUBSTRING(@Str1, Num, 1) = SUBSTRING(@Str2, Num, 1) THEN 0 ELSE 1 END IsTheSame FROM CTE ) SELECT TOP 1 Num FROM F WHERE IsTheSame = 1 ORDER BY Num ASC;
 hidden batch(es)