1

Is there any way that I can compare 2 datatables with each other, both will have the same columns but I would like to check the rows in them to see which ones exist and which ones don't in each of the tables, is there an elegant way to do this?

I am using c# ASP.NET too.

Raidri
  • 17,258
  • 9
  • 62
  • 65
Coesy
  • 936
  • 1
  • 10
  • 30

3 Answers3

2

Refer this..

http://forums.asp.net/t/1541581.aspx

Compare two DataTables to determine rows in one but not the other

Community
  • 1
  • 1
Geeth
  • 5,282
  • 21
  • 82
  • 133
  • Thanks, it was more "doing it programatically" I was looking for than actual SQL Compare type software, cheers folks. – Coesy Oct 12 '10 at 01:41
1

Try this product, I've used it in the past and its great for this kind of thing. There is a free 14 day trial so might be what you are after.

http://www.red-gate.com/products/SQL_Compare/

Cheers Tigger

WooHoo
  • 1,912
  • 17
  • 22
  • I think he wants to compare datatables rather than database tables, unless this can do that too? – Iain Ward Oct 11 '10 at 12:29
  • Sorry i miss-read the question - try this link for what your after. http://kseesharp.blogspot.com/2007/12/compare-2-datatables-and-return-3rd.html – WooHoo Oct 11 '10 at 12:29
0

For comparing the schema of the database, SQL Compare is great.

If what you are comparing is the data, you can use SQL Data Compare, another product from Red Gate:

http://www.red-gate.com/products/SQL_Data_Compare/

I have been using these products for about 4 years and they are almost a complete replacement for a DBA. They work great for deploying databases and data from DEV>TEST>PROD or for making live backups for testing against.

The best part is you never have to worry if something is different between your staging and production environment - this tool will find and fix nearly any difference.

Full Disclosure: I don't work for Red Gate, I am a happy customer.

NightOwl888
  • 55,572
  • 24
  • 139
  • 212