Move the selected contacts into your main Contacts folder. Single-click one of the contacts in the folder, then press Ctrl+A to select all of the contacts. This is the folder that is currently empty.Ĭopy the contacts from the Duplicates folder back into your main Contacts folder Select the option Do not import duplicate items.Ĭhoose your main contacts folder as the destination folder. Select Import from another program or file.īrowse to find the file you created in the procedure above. Note: In Outlook 2010, select File > Open > Import and skip to step 3. Select File > Open & Export > Import/Export. Your primary contacts folder should now be empty. Press Ctrl+A to select all of your contacts.Įither drag and drop your contacts into the Duplicates folder or use Ctrl+Shift+V to open the Move to Folder dialog and select your Duplicates folder. Give your new folder a name, for example Duplicates.Ĭlick back into your main Contacts folder. Right-click on your current Contacts folder and select New Folder. To take advantage of the duplicate detection feature in Outlook's import process, use the following steps The fastest way to delete a large number of duplicate contacts is to export them to a file, then import them into a new folder. If you have a large number of duplicate contacts, deleting the duplicates one by one can be tedious and time-consuming. When you've selected all the duplicates, press Delete or Ctrl+D.ĭelete a large number of duplicate contacts by using export and import In your list of contacts, hold down Ctrl and click each contact you want to delete. This is the easiest view to use to scan your contacts list and see the duplicates. In this situation, you should use Method 1 or some similar method instead.On the Ribbon, in the Current View group, click the bottom right corner of the views box, and then click Phone. However, this method does not work in outdated versions of SQL Server that do not support the ROW_NUMBER function. For best performance, you should have a corresponding index on the table that uses the key_value as the index key and includes any sorting columns that you might have used in the ORDER BY expression.It does not require you to join the original table with itself (for example, by using a subquery that returns all duplicate records by using a combination of GROUP BY and HAVING).It does not require you to temporarily copy the duplicate records to another table.Method 2 is simple and effective for these reasons: If your logic to delete duplicates requires choosing which records to delete and which to keep based on the sorting order of other columns, you could use the ORDER BY expression to do this. This value indicates that the records are duplicates.īecause of the (SELECT NULL) expression, the script does not sort the partitioned data based on any condition. Deletes all records that received a DupRank value that is greater than 1.Uses the ROW_NUMBER function to partition the data based on the key_value which may be one or more columns separated by commas.The ROW_NUMBER function that was introduced in Microsoft SQL Server 2005 makes this operation much simpler: DELETE T This method also incurs overhead because you are moving the data.Īlso, if your table has an IDENTITY column, you would have to use SET IDENTITY_INSERT ON when you restore the data to the original table. However, it requires you to have sufficient space available in the database to temporarily build the duplicate table. Moves the rows in the duplicate table back into the original table.Deletes all rows from the original table that are also located in the duplicate table.Moves one instance of any duplicate row in the original table to a duplicate table.This script takes the following actions in the given order: Run the following script: SELECT DISTINCT * Then, try the following methods to remove the duplicate rows from the table. For demonstration, start by creating a sample table and data: create table original_table (key_value int ) There are two common methods that you can use to delete duplicate records from a SQL Server table. Original product version: SQL Server Original KB number: 70956 Summary This article provides a script that you can use to remove duplicate rows from a table in Microsoft SQL Server.
0 Comments
Leave a Reply. |