• Thank you Lowell and Sean! Much appreciated!

    This reply post is for Lowell. I am testing out your codes and I think I'm slightly not getting some part of the codes. For one instance: Rather selecting specific values, we like to get all the values in the [TO] field:

    (Lowell's code)

    -------------------------------------------------------------------

    AS

    (

    SELECT 'John Doe1 <John.Doe1@abcd.com>' UNION ALL

    SELECT 'John Doe2 <John.Doe2@abcd.com>' UNION ALL

    SELECT 'John Doe3 <John.Doe3@abcd.com>' UNION ALL

    SELECT 'John Doe1 <John.Doe1@abc.com>; Mary Doe1 <Mary.Doe1@abc.com>' UNION ALL

    SELECT 'John Doe3 <John.Doe3@abc.com>; Mary Doe1 <Mary.Doe2@abc.org>' UNION ALL

    SELECT 'John Doe1 <John.Doe1@abc.com>; Mary Doe1 <Mary.Doe1@abc.com> ;Bill Doe1 <Billie.Doe1@abc.com>; Katie Doe1 <Katie.Doe1@abc.com>' UNION ALL

    SELECT 'John Doe3 <John.Doe3@abc.com>; Mary Doe1 <Mary.Doe2@abc.org> ;Bill Doe1 <Billie.Doe1@abc.com>; ' UNION ALL --notice teh EXTRA semicolon

    SELECT 'Lowell Mumble Mumble <Lowell@somedomain.com>'

    ),

    ---------------------------------------------------------------------

    Is there a way I can just select all values in the [TO] field instead of the above and Union All?

    Additionally, I think myfunc.Item is not in the tbldoc and dbo.DelimitedSplit8K is an invalid name after I set it to run. Should this function be added to tbldoc? I am not familiar with this custom function. How can I have this function in the tbldoc?

    Thank you Lowell! You are awesome!