How to: Import Updates from a Database into the Database Project
When you first create a database project, you typically import the database schema from an existing production database. If, during the course of your development work, changes were applied to the production server, you might need to import those changes into your project. You cannot use the Import Database Schema command because it is available only for projects that do not already contain database objects. To import changes that were made to the database server, you must use Schema Compare.
Note
When you use Schema Compare to update a database project, objects that are present in the database project but not in the source database are not dropped. This behavior differs from when you compare two databases. After you update a database project to match a source database, you must manually delete any objects that are not present in the source database from the database project.
To import updates from an existing database into the database project
Open the database project in Visual Studio. For more information, see How to: Open a Database or Server Project.
Note
If you do not already have a database project, you should instead see Starting Team Database Development for information about how you can create a database project and import the database objects and settings for the first time.
On the Data menu, point to Schema Compare, and click New Schema Comparison.
The New Schema Comparison dialog box appears.
Note
You can also right-click the database project in Solution Explorer or Schema View and then click Compare Schema.
In Source Schema, click Database, and click the connection to the database from which you want to import schema updates.
In Target Schema, click Project.
The project should default to your open database project.
Click OK to begin the comparison.
When the comparison is completed, the results appear.
Specify the Update Action for the differences.
By default, all changes are synchronized.
On the Data menu, point to Schema Compare, and click Write Updates.
The specified changes are written to the database project, synchronizing it with the database.
Note
You can also click Write Updates on the Schema Compare toolbar.
See Also
Tasks
How to: Create Database and Server Projects
How to: Set Options for Comparing Database Schemas
How to: View Schema Differences
How to: Synchronize Database or Server Objects
Walkthrough: Comparing the Schemas of a Database and Database Project