How to: Modify Database Objects

The database project contains the definitions for the objects in your database. To update your deployed database, you modify the database object in your database project, and then you build and deploy the updated database project to your server. Solution Explorer shows you the files that your database project contains, and Schema View shows you the database objects that are defined in those files.

To modify a database object from Schema View

  1. Open the solution that contains your database project.

  2. If Schema View does not appear, open the View menu and click Database Schema View.

    Schema View appears.

  3. In Schema View, expand the database project and locate the object that you want to modify.

  4. Click the database object that you want to modify.

  5. On the View menu, click Open.

    The Transact-SQL editor appears. It contains the definition for the database object that you clicked. For more information, see Editing Database Scripts and Objects with the Transact-SQL Editor on the Microsoft web site.

    Note

    Instead of using the menu, you could also double-click the database object that you want to modify.

  6. Modify the database object to make your change.

  7. On the File menu, click Save FileName.

    If you introduce any syntax errors in the object definition, one or more errors appear in the Error List window, and the object might not appear in Schema View until you resolve the errors. You can double-click an error in the Error List window to jump to the source of the error.

    You can now build and deploy your updated database project. For more information, see How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File and How to: Deploy Changes to New or Existing Databases.

To modify the file that contains a database object definition from Solution Explorer

  1. Open the solution that contains your database project.

  2. In Solution Explorer, expand the database project and locate the file that contains the object that you want to modify.

  3. Click the file that contains the database object that you want to modify.

  4. On the View menu, click Open.

    The Transact-SQL editor appears. It contains the definition for the database object that you clicked.

    Note

    Instead of using the menu, you could also double-click the database object that you want to modify.

  5. Modify the database object to make your change.

  6. On the File menu, click Save FileName.

    If you introduce any syntax errors in the object definition, one or more errors appear in the Error List window, and the object might not appear in Schema View until you resolve the errors. You can double-click an error in the Error List window to jump to the source of the error.

    You can now build and deploy your updated database project. For more information, see How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File and How to: Deploy Changes to New or Existing Databases.

See Also

Tasks

How to: Build a Database Project to Generate a Compiled Schema (.dbschema) File

How to: Deploy Changes to New or Existing Databases

How to: Define Permissions for Database Objects

Concepts

Creating and Modify Database and Server Objects

An Overview of Database Build and Deployment