Question : INSERT INTO table with no Duplicates

I have a task, whenever I insert into a table, I'm not Inserting Dupes.

For Instance, for already exists data I check the Dupes.
Query:
select [IDENTITY],count(*) as Cnt
from cust
group by [Identity] having count(*) > 1

I need to delete the Dupes in CUST and next time when Inserting make sure I have no dupes.

Here is the issue, when I tried to Insert the Duplicate data into a tempCust has same schema of Cust, It doesn't insert. Since I had only one Field in Group By.

I looked on Internet and found one solution:

SET ROWCOUNT 1
SELECT NULL
WHILE @@rowcount > 0
DELETE CUST
FROM CUSTas ct
INNER JOIN
(SELECT [Identity]
FROM cust
GROUP BY [Identity] HAVING count(*) > 1)
AS Dupes ON ct.[Identity] = Dupes.[Identity]
SET ROWCOUNT 0

It works but taking log time to execute and get me the results.


when I try I get the fields are not in aggregate .

Answer : INSERT INTO table with no Duplicates

Without examples, it's tough to debug, but I recently ran in to some similar problems.  It seems that the style of the containing element (usually a div) was messing up the style of the modal.  I moved the modal out of as many nested elements as possible and the problems went away.  Can you try something like that?
Random Solutions  
 
programming4us programming4us