https://documentation.red-gate.com/sdc14
About SQL Data Compare
With SQL Data Compare, you can compare and deploy the data in two Microsoft SQL Server databases.
You can also compare a backup with a database, a scripts folder, or another backup.
Selecting tables and views
When you create a project and you have selected your data sources, you can specify which tables, views, and columns to compare.
SQL Data Compare automatically maps tables and views with the same name and schema (owner).
The Tables & Views tab enables you to:
- map tables and views
- select the comparison key for each table or view
- select the tables and views that will be compared
- map specific columns
- select the columns that will be compared
SQL Data Compare lists the tables and views in the source and target.
Tables and views with identical or similar names are displayed side-by-side:
The upper pane displays tables and views that are fully Mapped or have Partial mapping. The lower pane displays Unmapped tables and views.
Selecting the comparison key
To match rows in the two data sources, SQL Data Compare requires a comparison key for each table or view.
SQL Data Compare automatically selects a comparison key when:
- tables contain a matching primary key, unique index, or unique constraint
- views contain a matching unique clustered index
For more information, see What's a comparison key?
Selecting the tables and views
Select the tables and views you want to compare by selecting or clearing the appropriate check boxes in the Compare column.
By default, the first time that you run a project all tables and views with identical or similar names are selected for comparison.
If the structure of the data sources you are comparing has changed while you are working on the project, click Refresh to update the Tables & Views tab. For example, if a table has been added to the database, click Refresh so that you can include the new table in the comparison.
If a table or view has been added to a database since you last ran the project, SQL Data Compare does not select the table or view by default.
实战
1.选择好source database和target database
2.切换到tables的tab,选择需要比较数据的表
3.确定之后,会弹出数据对比页面。
下图中source14个变化,有385个不同,target有2个不同
我们关注的是source,所以把different和target勾选去掉。
4.切换到下面的only in left的tab,然后选择需要同步的数据行。 deploy