Skip to main content
Inspiring
February 28, 2010
Question

Inserting a list with 1 query

  • February 28, 2010
  • 2 replies
  • 2098 views

Hi

I have a list of email addresses seperated by a comma.

I want to insert all of those email address into a table using 1 query.

Is that possible?

Here is my the list i have...

<Cfset mylist = "andt@mybub.com,del@fusebox.co.za,greg@fusebox.co.za,al@fusebox.co.za,moddit@telkomssa.com">

Is it possible to insert using 1 query?

Thanks in advance.

Regards

Delon

    This topic has been closed for replies.

    2 replies

    Inspiring
    March 5, 2010

    Thanks for all the assistance.

    Dan, Owainnorth and co really helped a lot.

    Now on to my next step.

    Conquering CFPOPS with 6000 emails in them.

    Inspiring
    February 28, 2010

    insert into yourtable

    (fields)

    select values

    from SomeSmallTable

    where 1 = 3

    <cfloop>

    union

    select #variables#

    from SomeSmallTable

    </cfloop>

    Make sure you test this with having your query inside the loop.  Intuititively this should be faster, but sometimes it isn't.

    Inspiring
    February 28, 2010

    Hi Dan

    Thank you for the reply.

    Im just a bit confused with the query.

    If i already have my list, why do i need to

    select values

    from SomeSmallTable

    where 1 = 3

    Thanks again

    Delon

    Inspiring
    February 28, 2010

    You need something above the word "union" to keep your sql syntax correct.