Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Benson Sibanda,
A while ago I once attended an interview where I was asked to write a short script that counts each letter of a given string and provide a grouping for each. This Script counts the number of times each letter appears in a string. It gives each letter and the number of occurrences. I have provided two methods. The first is a CTE based method and the second is a while loop. I havent tested this with a large data set but for a string with few characters both methods will be good performance wise.
find whether a upper case letter is there in a given string
Comparison of the new methods of splitting strings in SQL Server 2016 to the tried and true methods
Parsing letters from numbers in a character entry
eswaran_r (Sql Server 2005 Sorting when having both english letter 'e' and french letter 'é')
Find the first available drive letter (working backwards from z)