compare two tables in different environments.
-
Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!
Do you want to compare the contents of the tables. If that's the case I think the quickest way could be to use EXCEPT[^]. If the table structure is the same, you could do comparison like:
SELECT * FROM FirstTable
EXCEPT
SELECT * FROM SecondTableand then other way round:
SELECT * FROM SecondTable
EXCEPT
SELECT * FROM FirstTableIf there are structural differences, specify the columns you want to compare.
The need to optimize rises from a bad design.My articles[^]
-
Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!
Are you talking about comparing the structure or the data? They require 2 different strategies. Do you want to do this for 1 pair of table or are you looking to compare an entire database? They require 2 different strategies. If you need to compare databases then look at Red-Gate sql and data compare tools.
Never underestimate the power of human stupidity RAH
-
Are you talking about comparing the structure or the data? They require 2 different strategies. Do you want to do this for 1 pair of table or are you looking to compare an entire database? They require 2 different strategies. If you need to compare databases then look at Red-Gate sql and data compare tools.
Never underestimate the power of human stupidity RAH
-
To be more clear, I would like compare the data with in two tables of same design. Would like to report all rows that are different.
-
Since you mentioned the
EXCEPT
solution, consider voting the post (http://www.codeproject.com/Messages/3802207/Re-compare-two-tables-in-different-environments.aspx[^]) good or bad depending how you feel the answer helped you.The need to optimize rises from a bad design.My articles[^]
-
Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!
Try D-Softs Database Compare d-softs.com
-
Hello, Is there some tool in sql server which would help me compare two tables and tell me what is different in it? Thanks!
Please check the following link which might help you: http://www.sqlteam.com/article/comparing-tables[^]
Om Prakash Pant