Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Removing Duplicate Values using Merge statement Expand / Collapse
Author
Message
Posted Sunday, February 17, 2013 11:01 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, June 12, 2013 9:19 AM
Points: 18, Visits: 98
i have one issue i have one merge statement in my procedure :but after merging i am getting duplicate values ,how do we remove duplicates in a merge statement
Post #1421036
Posted Monday, February 18, 2013 12:03 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 10:10 AM
Points: 838, Visits: 2,199
It sounds like your source has duplicated rows, in this case its usually because the process that built the source dataset is incorrect, or that there is a data anomaly that is causing the duplication.

I would suggest that you check the source data and the process that builds them to and try and work out why you have the duplicated lines then and work forward.

As a last gasp everything else has failed you could use ROW_NUMBER() and filter where this is one on the insert and update as it will more than likely affect the merge in both of these areas.


_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1421045
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse