Share via


How to: Create a SQL Server Project

SQL Server projects in Visual Studio assist in the creation of stored procedures, triggers, aggregates, user-defined functions, and user-defined types using .NET Framework languages such as Visual Basic, Visual C#, and Visual C++.

Note

SQL Server projects require a reference to SQL Server 2005 or later.

Note

The common language runtime (CLR) integration feature is 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.

After creating a SQL Server project, create the database objects you want to deploy to the SQL Server. The following table provides links to Help topics that describe how to create the available database objects:

Database Object

Information

Stored Procedure

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

Trigger

How to: Create and Run a CLR SQL Server Trigger

Aggregate

How to: Create and Run a CLR SQL Server Aggregate

User-defined Function

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

User-defined Type

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

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Creating a New Project

To create a new SQL Server project

  1. From the File menu, create a new project.

  2. In the New Project Dialog Box, select and expand a language node in the Project Types area.

  3. Select the Database node.

  4. Select the SQL Server Project template.

  5. Click OK.

Connecting to a SQL Server Database

SQL Server projects require a connection to a database running on SQL Server 2005 or later. If connections to SQL Server 2005 databases are available in Server Explorer, then they will be listed in the Add Database Reference dialog box.

To connect to a SQL Server 2005 database

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

Other Resources

SQL CLR Database Debugging