|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.|
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. 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:
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.
To create a new SQL Server project
From the File menu, create a new project.
In the New Project Dialog Box, select and expand a language node in the Project Types area.
Select the Database node.
Select the SQL Server Project template.
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
Connect to a SQL Server 2005 database or later by completing the Add/Modify Connection Dialog Box. For more information, see Add/Modify Connection (Microsoft SQL Server).
Select an existing database connection in the Add Database Reference Dialog Box to use for the SQL Server project. For more information, see Add Database Reference Dialog Box.