Udostępnij za pośrednictwem


How to: Deploy Database Refactoring Changes

When you work in Visual Studio Premium, you change an offline representation of the database. To commit those changes to a live database, you must build and deploy the database project. You follow the same process whether you are deploying your changes to a development database, a test database, or a production database.

To set the deployment properties for the project

  1. In Solution Explorer, click the database project.

  2. On the Project menu, click YourSolution Properties.

    The project properties appear.

  3. Click the Deploy tab.

  4. In the Deploy action list, click Create a deployment script (.sql) and deploy to the database, and click Edit.

  5. In the Connection Properties dialog box, set the connection properties for the database where you want to work, and then click OK.

    The Target Connection box is filled with the correct connection string.

  6. In the Target database name box, type the name of the target database.

    Warning

    By default, the Target database name box is populated with the name of the database project. Make sure that you change this field if the database project has a different name from the target database.

  7. Set other properties as appropriate.

    For more information, see How to: Configure Properties for Deployment Details.

  8. On the File menu, click Save All.

To build a database project

  • On the Build menu, click Build Solution.

    The deployment script is built based on the project properties that you have set. The status of the build appears in the Output window, and Build: 1 succeeded or up-to-date should appear as the last line.

To deploy a database project

  1. In Solution Explorer, click the database project.

  2. On the Build menu, click Deploy YourProject.

    You can also right-click the project in Solution Explorer and click Deploy.

    The database project is deployed to the target database by using the deployment script. The status of the deployment appears in the Output window, and Deployment succeeded should appear as the last line.

See Also

Tasks

Walkthrough: Apply Database Refactoring Techniques

Concepts

Rename All References to a Database Object

Build and Deploy Databases to an Isolated Development Environment