SQL question

Man of Honour
Joined
17 Feb 2003
Posts
29,640
Location
Chelmsford
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
 
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