Compare table data on two different databases
-
Export to text files and use a difference tool on the files. Just one suggestion. :)
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
Export to text files and use a difference tool on the files. Just one suggestion. :)
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
You can do it that way but shame on you! :laugh:
-
What database server are you using?
-
You can do it that way but shame on you! :laugh:
Actually it's not the only way I do it, but I have found it a useful way when 'migrating' an application from one physical DB to another. I usually automate it so that I have only to review a log report of any differences that are actually discovered. But considering that there are many reasons for comparing the data, until you know all the requiremens, sometimes the simple solutions work best. :)
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
What database server are you using?
-
Example of finding records in D1 that are not in D2
SELECT D1.[DepartmentID]
,D1.[Name]
,D1.[GroupName]
,D1.[ModifiedDate]
FROM [AdventureWorks].[HumanResources].[Department] D1
LEFT JOIN [AdventureWorks2008R2].[HumanResources].[Department] D2
ON D1.DepartmentID = D2.DepartmentID
WHERE D2.DepartmentID IS NULLNotice how the table is referenced by Database.Schema.Table. Use the where clause to compare individual columns.