0

I have an excel sheet with customer data : firstname, lastname, dob, streetname1, streetname2, city and I want to compare the data with our SQL Server database.

If the fields in the excel match the data in SQL, then I want to return the SQL row.

Can anyone advice on how to do this? I tried loading the data into two datatables, and compare, but I am unable to achieve what I want so I am wondering if there is a different way.

The issue with the datatables is linked to this DataRelation Compare tables would appreciate some guidance on this

Unfortunately I don't have access to importing the excel data into the database so it should be done externally.

Dale K
  • 25,246
  • 15
  • 42
  • 71
edcoder
  • 503
  • 1
  • 5
  • 19
  • I think you need to join the DataTables (or database columns) so the fields from the SQL query are the same as the excel columns. – jdweng May 29 '19 at 09:31
  • it's not a good idea to compare the data in `Server-Side` as you will hit a memory limitation issue. I would suggest to transfer the data to the `Database` and then join the temp data with the main table using a primary field and then build your comparison logic. – vikscool May 29 '19 at 09:33
  • Yes I agree @vikscool. no access from the vendor. – edcoder May 29 '19 at 09:36
  • If you have access to query the data in the `Database` then i would suggest to query it using `FirstName`,`LastName`(*add any other field which can be used to uniquely identify the records in the DB*) from the excel sheet and then build your comparison logic afterwards. – vikscool May 29 '19 at 09:45

0 Answers0