to find Duplicates

  • Hi,

    I have a table Employee(AutoID, EmpID, EmpName, empDpt, emproll, empcno). The data is coming from Lotus notes database via Lotus notes agents. Here I want to find is there any duplicates in the table. My actual requirement is as follows__

    I want to know is there any duplicates in AutoID column. AutoID is autogenerated one in Lotus notes. In SQL Server, the primary key is EmpID. So how can we find out the duplicates in the column "AutoID".

    Do we need temptable to know the duplicates? I just want to check on every week using SSMS. So I don't delete them since it is not from SQL server it is from another Lotus notes db.

    Thank You

  • Hi

    Try this:

    SELECT AutoId, COUNT(*) Duplicates

    FROM YOURTABLE

    GROUP BY AutoId

    HAVING COUNT(*) > 1

    Greets

    Flo

  • Hi

    You may want to check out the below link to delete the duplicate records:

    http://support.microsoft.com/default.aspx/kb/139444

  • Florian Reischl (4/13/2009)


    Hi

    Try this:

    SELECT AutoId, COUNT(*) Duplicates

    FROM YOURTABLE

    GROUP BY AutoId

    HAVING COUNT(*) > 1

    Greets

    Flo

    Flo, Thanks a lot for you help. I will work on this to make this as a body for a mail.

    Thanks Vijaya for your link. But I don't require this. LN db admin has to deal with these duplicates.

    Thank You

  • Thanks for the feedback! Glad to help you.

    Have a nice day

    Flo

  • Hi Venki,

    Thats a good way to eliminate the duplicates. i.e. Implementing all the necessary changes to eliminate the duplicate records on the source side.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply