SQL Used to compare records in tables

Read Time:26 Sec

I have been using this little SQL quite a bit lately. It is very handy in finding records that are in one table but not in the same table in a different environment.

SELECT * FROM [JDE_DEVELOPMENT].TESTCTL.F951000 
EXCEPT 
SELECT * FROM [JDE_PRODUCTION].PRODCTL.F51000

It can also be used to do the insert of those records that are missing by adding an INSERT INTO statement.

INSERT INTO [JDE_PRODUCTION].PRODCTL.F951000 
SELECT * FROM [JDE_DEVELOPMENT].TESTCTL.F951000 
EXCEPT 
SELECT * FROM [JDE_PRODUCTION].PRODCTL.F51000 

Author

Stewart Schatz

Career: Principal CNC Consultant for Syntax Systems Limited specializing Oracle JD Edwards EnterpriseOne and the technology that supports it. Side Hustle: Owner/Operator of E1Tips.com Location: Lancaster, PA USA  What I like to do: Invest in Family, Explore Technology, Lead Teams, Share Knowledge/Experience, Hunt, Hike, etc.
Happy
Happy
0
Sad
Sad
0
Excited
Excited
0
Sleepy
Sleepy
0
Angry
Angry
0
Surprise
Surprise
0

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Previous post Empty All User’s Recycle Bins
Next post Oracle Weblogic 12.1.2 Node Manager Bug – FORCE_SHUTTING_DOWN