Skip to main content
January 19, 2011
Question

Multiple Insertion

  • January 19, 2011
  • 3 replies
  • 711 views

I have written an sp to insert into a table while clicking a link. The table contains a datetime column. The problem is while inserting, its getting inserted 3 similar records with the same  date and time value(same value for second too). I have used 

CF_SQL_TIMESTAMP as type while insertion in  cfprocparam

This topic has been closed for replies.

3 replies

January 24, 2011

Thanks for the replies. I can't figure out the exact reason, but fixed it. Myself added a slight modification to the sp using

'if exists' for that particular customer record with the time to be inserted.

Inspiring
January 21, 2011

Hi,

When using date-time as table key's in a database, you could get doubles when bulk-inserting. This happens because they all get inserted on the same millisecond. I usually fix this by adding an auto-increment number field to the table, which will stand as the table key to make the record unique.

However, if that is not your case, see Adam's post.

Cheers Bert.

Inspiring
January 21, 2011

Forcing the records to be unique in this manner results in duplicate records.  If this is not what you want, a better approach is to use a multi-field primary key.

Inspiring
January 19, 2011

Excellent.

However it's hard to say anything sensible beyond that without seeing any code.  Or an indication as to whether the proc is being called once and inserting three records, or the proc is inadvertantly being called three times, or... what....

What troubleshooting have you done already to solve this?  What have you ruled out as being the cause of the problem?

--

Adam