Share via


How to: Control Data Loss during Deployment to an Existing Database

When you make changes to a database project and deploy them to a database server, some changes can result in data loss from database objects being dropped and recreated. You can set an option on your database project to control whether a deployment should be canceled if a change could result in data loss. You might decide to allow data loss if you can easily regenerate the data. For example, you might take this approach if you are working in an isolated development environment on a database that you populated with test data by using Data Generator.

To allow data loss during deployment to an existing database

  1. In Solution Explorer, click the database project for which you want to configure properties.

  2. On the View menu, click Property Pages.

    The properties dialog box for your database project appears.

    Note

    You can also right-click the database project and click Properties.

  3. Click the Build tab.

  4. Clear the Block incremental deployment if data loss might occur check box.

  5. On the File menu, click Save Selected Items.

    The changes to your project properties are saved. Subsequent deployments of the database project will allow changes that result in data loss.

To prevent data loss during deployment to an existing database

  1. In Solution Explorer, click the database project for which you want to configure properties.

  2. On the View menu, click Property Pages.

    The properties dialog box for your database project appears.

    Note

    You can also right-click the database project and click Properties.

  3. Click the Build tab.

  4. Select the Block incremental deployment if data loss might occur check box.

  5. On the File menu, click Save Selected Items.

    The changes to your project properties are saved. Subsequent deployments of the database project will cancel the deployment if changes would result in data loss.

Security

To deploy any changes to a target database, you must have permissions to make the changes in that database.

See Also

Tasks

Walkthrough: Deploy Changes to an Existing Version-controlled Database

Concepts

An Overview of Database Build and Deployment
Protecting Data during a Renaming Operation
Terminology Overview of Team Edition for Database Professionals

Other Resources

An Overview of Database Project Settings
Deploying Refactoring Changes to a Database