• Another Option...

    Declare @t1 Table(mid int, val varchar(100))

    Insert into @t1

    Select 1,'123' union all

    Select 2,'123456' union all

    Select 3,'123456789' union all

    Select 4,'123456789123'

    Declare @vChk varchar(100)

    Set @vChk = '123'

    Select Top 1 * from @t1

    where val like '%' + @vChk + '%'

    Order By Len(val) desc

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]