SQL question

Man of Honour
Joined
17 Feb 2003
Posts
29,640
Location
Chelmsford
Permabanned
Joined
23 Apr 2014
Posts
23,553
Location
Hertfordshire
Does sybase have string split? This works in sql, 6 returned total on the given data.

select SUM(number) from (
select emails, COUNT(value) as number from tblTest
cross apply string_split(emails, ',')
GROUP BY
emails) a
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
You could do it by counting the number of @ symbols in the column:

SELECT SUM(LENGTH([columnname]) - LENGTH(STR_REPLACE([columnname], "@", null)))
FROM table

That takes the number of characters in the email address column then subtracts the number of characters in the column if you remove all the @ symbols so you'll be left with the number of symbols contained in that column.
 
Last edited:
Back
Top Bottom