SQL insert double?

Results 1 to 2 of 2

Thread: SQL insert double?

  1. #1
    Join Date
    Dec 1969

    Default SQL insert double?

    I use codecharge to build an application. In codecharge theres a function called before insert. I put my own sql statement(insert statement) there. Now what happens if I insert it insert twice into the database.What can I do do make this right?

  2. #2
    Join Date
    Dec 1969

    Default Well I'm not

    familiar with codecharge, however if you insert a record twice in a table and the table has primary key(s), then you are probably going to receive an error since you have duplicate keys. So you need to perform an UPDATE instead of an INSERT if that particular record exists in your table. <BR><BR>A suggestion would be to place logic in the function where you are putting the SQL statement to build either an UPDATE or an INSERT statement.<BR><BR>Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts