These statement not only work for Microsoft SQL as well as for any other Databases.
Following script finds records which exist in source table but not in target table.
The SQL statements can be modified for more than one column in Primary Key.
In SQL Server 2005 or later, EXCEPT operator can be used.
Following script finds records which exist in source table but not in target table as well as records which exist in target table but not in source table.
But Union operator can slow down the execution for tables with large amounts of data.
very nice script.
ReplyDeleteHi,
ReplyDeleteI have two tables in two different databases.
And I want to compare the data in these tables.
Both tables has same structure.
Can you please help me in this?
Any scripts?
thanks in advance.
You can use same script , you just need to mention fully qualified name (ServerName.Databasename.Schema.TableName)of databases
ReplyDelete