Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL query to compare the two tables

Author  Topic 

pamaiah1984
Starting Member

1 Post

Posted - 2013-12-26 : 20:32:34
Hi,

I am new to writing the queries in SQL.

I want to write a query which will compare the data of two tables which are resides in DEV server and PROD Server.

For the conncetivity purpose we are creating the DB link between DEV and PROD server.

Please help giving the query to compare the data of table in DEV and table in PROD


Regards,


venkata

anujkrathi
Starting Member

9 Posts

Posted - 2013-12-26 : 23:13:10
Hi Venkata,
You haven't specified how do you want to compare both tables. means do you want to see similar records or non-similar records or anything else.
We can't directly compare tables in SQL. We must have to define some condition, so that sql server will compare both tables.
Can you please specify your requirement.

thanks,
Anuj
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-28 : 03:59:37
ideally you compare on key columns to identify whether record is missing etc.
if you want to compare other columns also then you'll need to use tool like tablediff

https://www.simple-talk.com/sql/sql-tools/sql-server-tablediff-utility/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -