How to detect duplicate rows in a SQL Server table?

前端 未结 5 725
渐次进展
渐次进展 2021-02-02 07:03

What is the most efficient way to detect duplicates in a 10 column / 50K row table? I\'m using MSSQL 8.0

5条回答
  •  自闭症患者
    2021-02-02 07:30

    In addition to the suggestions provided, I would then go to the effort of preventing duplicates in the future, rather than trying to locate them later.

    This is done using unique indexes on columns (or groups of columns) that are supposed to be unique. Remember that data in the database can be modified from other locations other than through the specific app that you are working on, so it's best to define what is and isn't allowed in a table at the DB level.

提交回复
热议问题