Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.