Reputation: 36
I have a file upload functionality. On upload click, I am inserting the excel data directly into sql table. My sql table doesn't have any unique column.
So whenever the same file uploaded multiple times, the records are duplicating.
How to restrict this duplicate excel file upload?
Upvotes: 0
Views: 245
Reputation: 3970
Either you can have a unique constraint/make an autoincrement primary key column to avoid duplicates. Moreover, you can also have a date column if you want your records to be inserted once per each date etc.
If you are doing your load via some command then you can run a post command after the load so as to rename the file or move the file once the loads done
Upvotes: 1