Required Permissions in Database Edition

Before you can perform an action on a database in Visual Studio Team System Database Edition, you must log on with an account that has certain permissions on that database. The specific permissions that you need vary based on what action you want to perform. The following sections describe each action that you might want to perform and the specific permission that you need to perform it.

  • Permissions to Create or Deploy a Database

  • Permissions to Refactor a Database

  • Permissions to Perform Unit Tests on a Database

  • Permissions to Generate Data

  • Permissions to Compare Schemas and Data

  • Permissions to Run the Transact-SQL (T-SQL) Editor

Permissions to Create or Deploy a Database

You must have the following permissions to create or deploy a database.

Actions

Required Permissions

Import database objects and settings

You must be able to connect to the source database.

  • If the source database is based on SQL Server 2000, you must be a user of the database, and you must have SELECT permission on the dbo.sysproperties table.

  • If the source database is based on SQL Server 2005, you must also own or have the VIEW DEFINITION permission on each object.

  • If the source database is based on SQL Server 2008, you must also own or have the VIEW DEFINITION permission on each object. Your login must have the VIEW SERVER STATE permission (for database encryption keys).

Import server objects and settings

You must be able to connect to the "master" database on the specified server.

  • If the server is running SQL Server 2000, you must be a user of the database, and you must have the SELECT permission on the dbo.sysproperties table. Your login must be a member of the sysadmin role.

  • If the server is running SQL Server 2005, you must have the VIEW ANY DEFINITION permission on the server. If the database contains any linked servers, you must also have the ALTER ANY LINKED SERVER permission.

  • If the source database is based on SQL Server 2008, you must have the VIEW ANY DEFINITION permission on the server. If the database contains any linked servers, you must also have the ALTER ANY LINKED SERVER permission. Your login must have the VIEW SERVER STATE permission (for database encryption keys).

Create or update a database project

You do not require any database permissions to create or modify a database project.

Deploy new database or deploy with Always Re-create Database option set

You must either have the CREATE DATABASE permission or be a member of the dbcreator role on the target server.

Deploy updates to an existing database

You must be a valid database user. You must also be a member of the db_ddladmin role, own the schema, or own the objects that you want to create or modify on the target database. You need additional permissions to work with more advanced concepts such as logins or linked servers in your pre-deployment or post-deployment scripts.

Use an assembly with the EXTERNAL_ACCESS option in a database project

You must set the TRUSTWORTHY property for your database project. You must have the EXTERNAL ACCESS ASSEMBLY permission for your SQL Server login.

Deploy assemblies to a new or existing database

You must be a member of the sysadmin role on the target deployment server.

For more information, see the SQL Server 2005 Books Online or the SQL Server 2000 Books Online.

Permissions to Refactor a Database

Database refactoring occurs only within the database project. You must have permissions to use the database project. You do not need permissions on a target database until you deploy your changes to it.

Permissions to Perform Unit Testing on a Database

You must have the following permissions to perform unit tests on a database.

Actions

Required Permissions

Execute a test action

You must use the execution context database connection. For more information, see Overview of Connection Strings and Permissions.

Execute a pre-test or post-test action

You must use the privileged context database connection. This database connection has more permissions than the execution context connection does.

Run TestInitialize and TestCleanup scripts

You must use the privileged context database connection.

Deploy database changes before you run tests

You must use the privileged context database connection. For more information, see How to: Configure Database Unit Test Execution.

Generate data before you run tests

You must use the privileged context database connection. For more information, see How to: Configure Database Unit Test Execution.

Permissions to Generate Data

You must have the INSERT and SELECT permissions on the objects in the target database to generate test data by using Data Generator. If you purge data before you generate data, you must also have DELETE permissions on the objects in the target database. To reset the IDENTITY column on a table, you must own the table, or you must be a member of the db_owner or db_ddladmin role.

Permissions to Compare Schemas and Data

You must have the following permissions to compare schemas or data.

Actions

Required Permissions

Compare the schemas of two databases

You must have the permissions to import objects and settings from the databases as described in Permissions to Create or Deploy a Database.

Compare the schemas of a database and a database project

You must have the permissions to import objects and settings from the database as described in Permissions to Create or Deploy a Database. You must also have the database project open in Visual Studio.

Write updates to a target database

You must have the permissions to deploy updates to the target database as described in Permissions to Create or Deploy a Database.

Compare the data of two databases

In addition to the permissions that you need to compare the schemas of two databases, you also need the SELECT permission on all of the tables that you want to compare.

For more information, see these pages on the Microsoft Web site: Books Online (SQL Server 2008), Books Online (SQL Server 2005), or SQL Server 2000 Books Online.

Permissions to Run the Transact-SQL (T-SQL) Editor

What you can do within the T-SQL editor is determined by your execution context to the target database.

See Also

Concepts

Terminology Overview of Database Edition