判断字符字串是否在字符串中
比如判断2是否在2,3,4,5 中效率最高的方法,
[解决办法]
- SQL code
select (case when len(replace(','+'1,2,3,4,5'+',',','+ltrim(2)+',','')) < len(','+'1,2,3,4,5'+',') then 1 else 0 end)
发布时间: 2012-10-17 10:25:46 作者: rapoo
判断字符字串是否在字符串中
比如判断2是否在2,3,4,5 中效率最高的方法,
[解决办法]
select (case when len(replace(','+'1,2,3,4,5'+',',','+ltrim(2)+',','')) < len(','+'1,2,3,4,5'+',') then 1 else 0 end)