Based on the updated question, this isn't the answer. You're looking to confirm that all values in string of delimited values exists in another string of delimited values, in this case the delimiter is '.'
select
case when charindex('44.22','12.33.44.65.22')>0 then 'true'
else 'false'
end
Update: if the search string is always in that format, this will work:
create function dbo.func1 (@StringToFind nvarchar(128), @StringToSearch nvarchar(128))
returns nvarchar(5) as
begin
return case
when charindex(left(@StringToFind,charindex('.',@StringToFind)-1),@StringToSearch)>0
and charindex(right(@StringToFind,charindex('.',reverse(@StringToFind))-1),@StringToSearch)>0
then 'true'
else 'false'
end;
end
go
select dbo.func1('44.22','12.33.44.65.22')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…