How do I count the number of specific characters in a string ?
Example:
declare @.var as varchar(50)
set @.var="1abc1efg1"
If I wanted to count the "1"...I'll get "3" for answer.
This could maybe done by using a while loop, but is there any T-SQL command for this???http://www.dbforums.com/t648578.html
select len(YourCol)-len(replace(YourCol,'1',''))
Showing posts with label 1abc1efg1. Show all posts
Showing posts with label 1abc1efg1. Show all posts
Thursday, March 22, 2012
Count "SPECIFIC" characters in a string
Subscribe to:
Posts (Atom)