# Create list of emails from query

**URL:** <https://forums.toadworld.com/t/create-list-of-emails-from-query/6996>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [December 5, 2011, 8:24pm UTC](https://forums.toadworld.com/t/create-list-of-emails-from-query/6996 "2011-12-05T20:24:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![planomax](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@planomax](https://forums.toadworld.com/u/planomax)\
**Post date:** [December 5, 2011, 8:24pm UTC](https://forums.toadworld.com/t/create-list-of-emails-from-query/6996/1 "2011-12-05T20:24:19Z")

</div>

I have a db table that has email addresses associated with certain reports. I’d like to send one email with everyone in the ‘TO’ field of the email.

Is there a preset method for this?

New to TDA and trying to get some tips. Thanks in advance.

Pete

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [December 6, 2011, 4:18pm UTC](https://forums.toadworld.com/t/create-list-of-emails-from-query/6996/2 "2011-12-06T16:18:19Z")

</div>

This can be accomplished by building a variable that has the value for your CC list:

Use a loop dataset activity and execute a query that selects the email column. Then for each row append to the value of your variable the email followed by a colin.

Dereference the variable and use in the CC of your email. (IE: “#email#”) The “#” dereference the variable.

See this blog for info on using variables in automation.  
[http://www.toadworld.com/Blogs/tabid/67/EntryId/498/Automation-Variables-Automation-variables-using-datasets.aspx](http://www.toadworld.com/Blogs/tabid/67/EntryId/498/Automation-Variables-Automation-variables-using-datasets.aspx)

Debbie

---

<div class="post-metadata">

**Author:** ![planomax](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@planomax](https://forums.toadworld.com/u/planomax)\
**Post date:** [December 8, 2011, 12:41pm UTC](https://forums.toadworld.com/t/create-list-of-emails-from-query/6996/3 "2011-12-08T12:41:15Z")

</div>

Thanks for the response. I got around the issue by using a coalesce query and I grab all the emails in a comma delimited list at once. However, I do like the method described and will give it a try.

Is there a limit on size of variable? Our email list sometimes gets VERY large.

Thanks again,

Pete

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [December 8, 2011, 2:56pm UTC](https://forums.toadworld.com/t/create-list-of-emails-from-query/6996/4 "2011-12-08T14:56:01Z")

</div>

There is no limit on lenth of variable. Give it a try and let me know how it goes

Debbie
