SQL Server 查询某字符在某列中现的次数

例如查询 “_” 的个数:

select len(WordType) - len(replace(WordType, '_', '')) [length] ,* from T1 order by len(WordType)

思路:将“_” 替换成 “空串”  然后用原字符串的长度减去替换后的长度

猜你喜欢

转载自blog.csdn.net/qq_32109957/article/details/104891770