Required Permissions in Team Edition for Database Professionals

Before you can perform an action on a database in Visual Studio Team Edition for Database Professionals, 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

  • Permissiont to Perform Unit Tests on a Database

  • Permissions to Perform Data Generation

  • Permissions to Compare Schemas and Data

  • Permissiont 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 schema

You must be able to connect to the source database. If the source database is based on SQL Server 2005, you must also own or have the VIEW DEFINITION permission on each object.

Create or update a database project

You must be a member of the dbcreator and securityadmin fixed server roles in the server instance that you specified for design-time validation. In addition, if you run Visual Studio without administrative credentials, you must have View Server State permissions on the server, and you must execute the following on the database instance that you specified for design-time validation:

USE MASTER

GO

GRANT EXECUTE ON sp_detach_db TO public

GO

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.

Create or modify assemblies in a database project

You must be a member of the sysadmin role in the database instance that is used for design-time validation.

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.

For more information, see TRUSTWORTHY Database Property and Creating an Assembly.

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 Perform Data Generation

You must have the insert permissions on the objects in the target database to generate test data by using Data Generator.

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 be able to connect to the target database. If the source database is based on SQL Server 2005, you must also own or have the VIEW DEFINITION permission on each object.

Compare the schemas of a database and a database project

You must be able to connect to the target database. If the source database is based on SQL Server 2005, you must also own or have the VIEW DEFINITION permission on each object. You must also have the database project open in Visual Studio.

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 the SQL Server 2005 Books Online or the SQL Server 2000 Books Online documentation.

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 Team Edition for Database Professionals

Other Resources

How to: Specify the Local Instance of SQL Server to use for Design-time Validation