Search

Tuesday, November 23, 2010

Count the Number of Occurrence of Character in a String – SQL Server Challenge

DECLARE @longWord varchar(28)='AntiDisEstablishmentArianism'SELECT CountCharacters =DATALENGTH(@longWord)- DATALENGTH (REPLACE(REPLACE(LOWER(@longWord),'a',''),'i',''))

No comments:

Post a Comment