sql server 查询字符串指定字符出现的次数

这里提取指定符串"A"在字段中的出现次数SQL为:
  
 select len(keyword)-len(replace(keyword, 'A', ' ')) from 表

  原理:用replace函数将要查找的字符替换为空字符,将替换之间的字符串长度-替换后字符串长度

原文地址:https://www.cnblogs.com/liwuyi/p/5525793.html