How to: Synchronize Database or Server Objects
After you compare the schemas of the source and the target, you can synchronize an entire schema or only the database objects that you specify within that schema. For more information, see Compare and Synchronize Database Schemas.
Note
The databases that you compare are known as the source and the target. When you synchronize database schemas, you update the target and leave the source unchanged. Although you can specify a project file (.dbschema) as the target, you cannot update a project file.
To update the target schema
Compare two schemas. For more information, see How to: Compare Database Schemas.
After the comparison finishes, the Schema Compare window lists the database objects that were compared. Each row represents one database object.
(Optional) In the Update Action column, specify whether to apply or skip the update to each object in the results list.
Individual synchronization actions are not performed immediately but stored for batch execution in the following step.
Note
To reset the Update Action column for all objects of a particular type, right-click the node for that type (for example, the Tables node), and click Restore Defaults.
To synchronize database objects that are different, missing, or new, do one of the following:
To update the target immediately, click Write Updates.
Except for objects marked as Skip, this choice applies the schema of the selected database objects in the source on the corresponding objects in the target. This synchronization means updating, creating, or dropping the target object.
Important Note: While the schema is being updated, you can cancel the operation by clicking Stop Writing to Target. If you stop the update, no changes are propagated for most object types. However, partial changes to User and Role objects might not get rolled back because these objects cannot be wrapped in transactions.
To review changes before updating the target, use the Schema Update Script window or click Export to Editor.
This choice generates a Transact-SQL (T-SQL) script and opens it in a T-SQL editor window. You can review the script before you run it against the target. The generated T-SQL script matches the script that would be run if you clicked Write Updates.
Note
Visual Studio Team System Database Edition does not automatically refresh the results that appear in the Schema Compare window after the Write Updates action finishes. Instead, the status bar is updated to suggest that you click Refresh. This behavior gives you the choice to compare schemas again, an action that could take a long time if the schemas are large.
To save changes to a file without viewing them in the T-SQL editor, click Export to File.
This choice generates a T-SQL script and saves it to the file name that you specify. The generated script matches the script that would be run if you clicked Write Updates. You might take this approach if another person will update the target later with the script that you provide.