Share via


How to: Deploy SQL Server Project Items to a SQL Server

After you build a SQL Server project, it is compiled into an assembly that can then be deployed to the database.

Note

The common language runtime (CLR) integration feature is turned off by default in Microsoft SQL Server and must be enabled in order to use SQL Server project items. To enable CLR integration, use the clr enabled option of the sp_configure stored procedure. For more information, see Enabling CLR Integration.

Tip

As an alternative to building, deploying, and debugging in three separate steps, you can use the Start command (F5) to build the assembly, deploy it to the database, and debug the database object. Select the Start Without Debugging command (CTRL+F5) to build the assembly and deploy it to the database.

To deploy items in a SQL Server project to a SQL Server

  1. Build the project by selecting Build <project name> from the Build menu.

    Note

    Resolve all build errors prior to deploying.

  2. Select Deploy <project name> from the Build menu.

    Note

    If you receive a message informing you that the project cannot be deployed, then you may need to manually create the assembly on the server. This error is typically the result of referenced assemblies in your project. For more information on manually deploying your assembly, see the Create Assembly page in the "SQL Server Books Online."

Next Steps

After deploying SQL Server project items to the database, you will likely want to run the item to test it.

To test a deployed database item

See Also

Tasks

How to: Create a SQL Server Project

How to: Create and Run a CLR SQL Server Stored Procedure

How to: Create and Run a CLR SQL Server Trigger

How to: Create and Run a CLR SQL Server Aggregate

How to: Create and Run a CLR SQL Server User-Defined Function

How to: Create and Run a CLR SQL Server User-Defined Type

Walkthrough: Creating a Stored Procedure in Managed Code

How to: Debug a SQL CLR Stored Procedure

Concepts

Introduction to SQL Server CLR Integration (ADO.NET)

Advantages of Using Managed Code to Create Database Objects

Item Templates for SQL Server Projects

Reference

Deploy Page, Project Designer

Attributes for SQL Server Projects and Database Objects

Other Resources

SQL CLR Database Debugging