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
 how many times does a letter appear in a name

Author  Topic 

amalshah71
Starting Member

9 Posts

Posted - 2006-11-30 : 07:19:58
i have a column containing employee name with datatype varchar.
i want to find out that how many times does letter 'y' appear in employee's name.

am a beginner to sql
help appreciated

cheers

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-30 : 07:21:29
Check this:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75441[/url]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-30 : 07:35:50
Harsh, if he do not remember his previous posting at all, you might as well write

LOOK FOR Highest frequency of same character, the bugfixed version with F_TABLE_NUMBER_RANGE function in this topic

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75441



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-30 : 07:42:28
Did I do something wrong?

He was not the OP of the question of "highest frequency of same character", it was afrika.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-30 : 07:55:55
You are absolutely correct! I stand corrected.
No, you did nothing wrong. It was I who thought amalshah71 WAS the OP...
I mixed http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75605 and http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75629

Sorry to both of you!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-30 : 08:55:21
This should do it:

-- Count letter a
select len('amalshah71') - len(replace('amalshah71','a',''))


CODO ERGO SUM
Go to Top of Page
   

- Advertisement -