如 字符串 1:ab
字符串 2:abcabcabc
返回 3
也就是 字符串2中包含几个字符串1
------解决方案--------------------
- SQL code
declare @s1 varchar(100)declare @s2 varchar(100)set @s1='ab'set @s2='abcabcabc'select (len(@s2)-len(replace(@s2,@s1,'')))/len(@s1)
declare @s1 varchar(100)declare @s2 varchar(100)set @s1='ab'set @s2='abcabcabc'select (len(@s2)-len(replace(@s2,@s1,'')))/len(@s1)