How to: Create a SQL Server Project
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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++.


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


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. From 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:


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.

Connect 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

© 2016 Microsoft