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
Build the project by selecting Build <project name> from the Build menu.
Note
Resolve all build errors prior to deploying.
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
Debug SQL Server project items using the Test.sql (debug.sql in Visual C+) script in your project. For more information, see How to: Edit the Test.sql Script to Run SQL Objects.
Execute the item by calling it from a query on the SQL Server. For example, if you deployed a stored procedure, run it by calling EXEC <StoredProcedureName> and passing in any expected parameters. For more information, see How to: Run Stored Procedures and User-Defined Functions.
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
Attributes for SQL Server Projects and Database Objects