dLight dLight - 1 year ago 74
SQL Question

Line break or Carriage return in a Delimited Field in Sql

I have an email column that stores a minimum of more than 10 emails in a row. Now, I want to write a query that puts each email on a separate line, e.g:


How do write this?

Answer Source

Use Replace()

select replace(MyEmailField, '<CurrentDelimeter>', char(13)) as NewEmail
from MyTable
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download