某个字符串在某个字段出现的次数

DECLARE @t table(s  VARCHAR(200))
insert into @t
SELECT 'Robot.H'
UNION ALL 
SELECT 'Robot.HaaRobot.HbbRobot.H'

SELECT s,(LEN(s+'*')-LEN(REPLACE(s,'Robot','')+'*'))/LEN('Robot')
from @t
posted @ 2008-11-05 17:56  roboth  阅读(338)  评论(0)    收藏  举报