This documentation is archived and is not being maintained.

Walkthrough: Deploy Changes to an Existing Version-controlled Database

In this walkthrough, you deploy changes from your database project to an existing database server. This task includes configuring your build and deployment settings for updating your database, building the database project, and deploying the changes.

This walkthrough assumes that you have completed both Walkthrough: Put an Existing Database under Version Control and Walkthrough: Modify Database Objects. If you have not completed both walkthroughs, you will not have a database project with pending changes to deploy to a target database.

To open the MyNorthwind solution

  1. On the File menu, point to Open, and click Project/Solution.

    The Open Project dialog box appears.

  2. Browse to the MyNorthwind folder, and double-click MyNorthwind.sln.

    The MyNorthwind solution opens and appears in Solution Explorer.

  3. Expand the Schema Objects subfolder if it is not already expanded.

    Next you specify your build configuration settings.

To configure your build and deployment settings

  1. In Solution Explorer, click MyNorthwind (the project, not the solution).

  2. On the Project menu, click MyNorthwind Properties.

    The project properties window appears.

  3. Click the Build tab.

    NoteNote

    If you had multiple configurations, in the Configuration list, you would click the configuration that you wanted to modify.

  4. Click the Edit button next to Target connection.

  5. Specify the connection information for the Northwind sample database from which you imported the schema in Walkthrough: Put an Existing Database under Version Control.

  6. Select the Block incremental deployments if data loss might occur check box if it is not already selected.

  7. Accept the default values for the other options. On the File menu, click Save Selected Items.

    Your changes to the project settings are saved to the database project file (MyNorthwind.dbproj). Your user-specific settings are saved to the MyNorthwind.dbproj.user file. Saving the changes causes MyNorthwind.dbproj to be checked out of version control.

    Next you build the update script for your database project.

To build your database project

  1. In Solution Explorer, click MyNorthwind (the project, not the solution). Note that on the Standard toolbar, Default is selected in the Solution Configurations list.

  2. On the Build menu, click Build MyNorthwind.

    Your database project is built. When the build completes, the Output window displays Build Succeeded. A build script is created in "My Documents\Visual Studio 2005\Projects\MyNorthwind\MyNorthwind\sql". The file name consists of MyNorthwind.DatabaseServer_InstanceName.MyNorthwind.sql.

  3. On the File menu, point to Open, and then click File.

  4. Browse to the "My Documents\Visual Studio 2005\Projects\MyNorthwind\MyNorthwind\sql" folder.

  5. Double-click the MyNorthwind.DatabaseServer_InstanceName.MyNorthwind.sql file that the build step just created.

    You can review the build script to see what changes will be deployed to the database server. When you are finished browsing, open the File menu, and click Close to close the file.

    In the final step, you will deploy your changes to the target database.

To deploy your build script

  1. In Solution Explorer, click MyNorthwind (the project, not the solution).

  2. On the Build menu, click Deploy MyNorthwind.

    Your database project is deployed. When the deployment completes, the Output window displays Deployment Succeeded.

    The changes that you made in the prior walkthrough have been deployed to the database server. You and your team could continue to make changes to the database project, deploying those changes when they were ready to be put on the server.

You can browse the updated database by using SQL Server Management Studio or Server Explorer in Visual Studio if you want to verify that your changes were deployed. You could also use the Schema Compare feature of Team Edition for Database Professionals to compare your database project to the deployed database.

Show: