I have a table that looks like this:
Emails | Data --------------------------------------------------------------------------------- [email protected];[email protected];[email protected] | Foo [email protected] | Bar
I want to parse out the delimited emails into their own rows such that it looks something like this:
Emails | Data --------------------------------------------------------------------------------- [email protected] | Foo [email protected] | Foo [email protected] | Foo [email protected] | Bar
I know there is a string_split function, but it would only work on the first column. I need some kind of join for this.
In the more recent versions of SQL Server, you can use string_split():
string_split()
select s.value as email, t.data from t cross apply string_split(t.emails, ';') s;
1.4m articles
1.4m replys
5 comments
57.0k users