Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 COUNT ALPHABETS

Author  Topic 

pnpsql
Posting Yak Master

246 Posts

Posted - 2012-05-04 : 02:41:56
HI TEAM ,

I NEED TO CHECK THE ALPHABETS IN STRING, THERE IS NO NEED TO COUNT NUMERICALS.PLS HELP

challenge everything

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-04 : 06:15:53
make use of the function here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79083&SearchTerms=fnFilterString


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

malpashaa
Constraint Violating Yak Guru

264 Posts

Posted - 2012-05-05 : 14:28:45
Try something like this:


SELECT T.str, SUM(LEN(T.str) - LEN(REPLACE(T.str, C.c, ''))) AS cnt
FROM YourTable AS T
CROSS JOIN
(VALUES('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'),
('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'),
('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'),
('V'), ('W'), ('X'), ('Y'), ('Z')) AS C(c)
GROUP BY T.str;




For us, there is only the trying. The rest is not our business. ~T.S. Eliot

Muhammad Al Pasha
Go to Top of Page
   

- Advertisement -