Is there MS SQL Server function that counts the number of times a particular character appears in a string?
try that :
declare @t nvarchar(max) set @t='aaaa' select len(@t)-len(replace(@t,'a',''))