Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple Insertion

Guest
Jan 18, 2011 Jan 18, 2011

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

TOPICS
Getting started
652
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 19, 2011 Jan 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 21, 2011 Jan 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 21, 2011 Jan 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 24, 2011 Jan 24, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources