Tag Info

New answers tagged

2

You will get that any time your input file has duplicates. In theory the MERGE command is doing everything in a batch so if you have the same row in the input data more than once it will try to insert it into the output table more than once giving you the error. Either dedupe your input file or use a CTE at the beginning of the MERGE to take care of it for ...


0

If you want to hunt down what key combinations are preventing the unique key from working, run this SELECT add1, city, state,COUNT(1) rowcount FROM mytable GROUP BY add1, city, state HAVING COUNT(1) > 1; To see the actual rows, run this SELECT A.* FROM mytable A INNER JOIN (SELECT add1, city, state,COUNT(1) rowcount FROM mytable GROUP BY add1, city, ...



Top 50 recent answers are included