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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query to get differences to reconcile between

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2014-01-01 : 20:10:15
Below 5 fields / columns data makes a row unique. loaded data in two diff tables.
Environment is diff one has "DEV" and other "PROD" hardcoded value, my objective is
to see diff between dev and prod
side data, we are planning on moving into prod next week.
i have seen some discrepancies in both environments.
Dev has lot more rows/records than prod.


Table Fields: in both tables Table1_dev , Table2_Prod

select Environment, metric_code, org_heir_cd, scenario_cd, calendar_day from Table1_dev;

select Environment, metric_code, org_heir_cd, scenario_cd, calendar_day from Table2_Prod;


I need a query, need to be compared with last four columns against both environments.(Table1_dev & Table2_Prod)

select metric_code, org_heir_cd, scenario_cd, calendar_day from Table1_dev
except
select metric_code, org_heir_cd, scenario_cd, calendar_day from Table2_Prod;


Thank you very much for the helpful info.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-02 : 13:10:52
you can use tablediff utility for easy comparison

http://www.mssqltips.com/sqlservertip/1073/sql-server-tablediff-command-line-utility/

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

- Advertisement -