-1

I want to import excel sheet data to sql database.In database there are already have records, i want to import another records from excel and want remove duplicate records. how can I do it

1st Table
enter image description here

2nd Table
enter image description here

I want to import 2 tables to 1 table and remove duplicate records

जलजनक
  • 3,072
  • 2
  • 24
  • 30
Thilini
  • 1
  • 1
  • You might wish to check out this previous question - [How to delete duplicate rows in SQL Server?](https://stackoverflow.com/questions/18390574/how-to-delete-duplicate-rows-in-sql-server) – Rajiv Xavier Apr 08 '22 at 03:24

1 Answers1

0

I'm not sure what your data looks like but this is how I would do it.

Load your new dataset into a different table. Query your newly imported table Left join your new data table Filter for nulls on the old table (only select records that are NOT in old table) Change this to an append query with "INTO X" line. Drop the staging table.

OR you could import them both and if they are the same format you can just Union them. Select * FROM Table A UNION Select * From Table B and that will remove dupes.

case42
  • 1