Good morning, I have an email column in a table that contains in some rows more than one email, separated by a semicolon. Actually i am trying to retrieve the email with this query
-- cdu_mail is the column
select
ltrim(rtrim(cdu_mail)),
substring(ltrim(RTRIM(cdu_mail)), 0, charindex(';',ltrim(RTRIM(cdu_mail))))
FROM Clientes
If i have more than one mail in the row the query retrieves correctly the first email, but if there is only one email in the row the result is blank.
What do i need to change to get all the mails correctly?
Thank you.