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',''))
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment