Pages
Home
.Net Framework
OOPS
C#
WCF
ASP.NET
SQL
EBooks for Interviews
About Me
Contact Me
Amazon.in Widgets
Count the number of occurrence of a character in a given string – SQL
Count the number of occurrence of a '
o
' in the given string:
Ram is a good boy.
DECLARE
@vc_string
varchar
(
40
)
SET
@vc_string
=
'Ram is a good boy.'
SELECT
LEN
(
@vc_string
)
-
LEN
(
REPLACE
(
@vc_string
,
'o'
,
''
))
AS
in_count
Output: 3
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Amazon.in Widgets
No comments:
Post a Comment