Skip navigation
Currently Being Moderated

<Cfquery> insert into generates duble entry

Jul 24, 2012 10:37 AM

Tags: #cfquery #cf9 #cf8 #cf10

Does anyone know, why an “ insert into “ could generates a double entry on a SQL table?

I use it in other routines and programs with success, but in this specific program, it’s being defiant, generating two entry with the same content.

Please, let me know if someone has the same problem or what I’m doing wrong?

I appreciate any help.

  • Currently Being Moderated
    Jul 24, 2012 12:27 PM   in reply to aijr

    There are many possible reasons.  I try to prevent it like this:


    insert into myTable


    select list_of_values

    where not exists

    (subquery to identify exisitng records)

    Mark as:
  • Currently Being Moderated
    Jul 31, 2012 11:32 AM   in reply to aijr

    The query itself is not causing the issue, you need to step back and figure out what is calling this code twice. In my experience, the most likely cause is someone double clicking on a link or button and the page executing this code is being called twice.

    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 6:43 AM   in reply to aijr

    Can you post the relevant query code so we can have a look?  A proper sql insert statement will not create double entries for sure.


    Is your cfquery statement in a loop?

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points