I have recently been working on a project that requires one simple table to insert data into. The problem here is that all the data inserted must only access the database via stored procedure and I want to ensure that no duplicate data is inserted in the database.
I have done quite a bit of research for many ways to perform duplicate data testing from building temp tables and on, but nothing has really stood out to me yet. I would really like to find some information on how to perform duplicate data testing using a stored procedure that allows to test the data being inserted before it is saved to the database; therefore, when the user inserts the fields and clicks the insert button, the fields will be tested against the existing data (via stored procedure) within the database before being added.
There are several ways to prevent duplicate data from being inserted into a table. One of them would be using a UNIQUE constraint.
But, before you get into the solution I'd like to ask you to provide us with the real table structure, some sample data, as well as the business rules you are trying to enforce. All this because there's also the chance that you are using an inadequate table design to fullfill your needs.