如何使用SQL Server查找字符的出现 [英] How to find the occurence of characters using sql server

查看:96
本文介绍了如何使用SQL Server查找字符的出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用sql server查找字符的出现情况

请发送上述问题的查询.

钦奈广场

输出为n作为2的重复.

我想要上面的输出.

谢谢,谢谢,
Narasiman P

how to find the occurence of characters using sql server

please send the query for the above question.

Place chennai

output as n as repetition of 2.

i want the above output.

Thanks & Rgds,
Narasiman P

推荐答案



您去了:
Hi,

Here you go:
declare @string varchar(100)
select @string = 'sfdasadhfasjfdlsajflsadsadsdadsa'
SELECT LEN(@string) - LEN(REPLACE(@string, 'd', '')) AS D_Count



祝一切顺利
--Amit



All the best
--Amit




请尝试这些链接

http://blog.sqlauthority.com /2010/08/16/sql-server-finding-the-occurrence-of-character-in-string/ [ http://www.sqlservercentral.com/Forums/Topic784777-338-1.aspx#bm785495 [ ^ ]

http://www.dbforums.com/microsoft-sql-server/976098-count-specific-characters-string.html [ ^ ]

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=144340 [ ^ ]

http://stackoverflow.com/questions/1860457/how- to-count-instances-of-character-in-sql-column [
Hi,

Please try these links

http://blog.sqlauthority.com/2010/08/16/sql-server-finding-the-occurrence-of-character-in-string/[^]

http://www.sqlservercentral.com/Forums/Topic784777-338-1.aspx#bm785495[^]

http://www.dbforums.com/microsoft-sql-server/976098-count-specific-characters-string.html[^]

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=144340[^]

http://stackoverflow.com/questions/1860457/how-to-count-instances-of-character-in-sql-column[^]

Regards
Sebastian


这篇关于如何使用SQL Server查找字符的出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆