Redigera

Dela via


Add New Items to a Project

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)

Add new items to a project to extend application functionality. A new item can be a query or a connection. SQL Server Management Studio has two project types: SQL Server Script Project, and Analysis Services Script Project. The project type determines the items that you can add to the project. For example, you can add a Transact-SQL query (a file with a .sql extension) to a SQL Server Script project, but you cannot add it to an Analysis Services Script Project.

SQL Server Management Studio does not allow you to create folders within projects. To organize your work, create multiple projects within the solution.

To add a new query to an existing project

  1. In Solution Explorer, select a target project.

  2. On the Project menu, click Add New Item.

  3. In the Add New Item dialog box, select a category in the left pane.

  4. Select a query template in the right pane, and then click Add. The new query is added in the Queries folder of the project.

  5. In the Connect to Database Engine dialog box, specify a connection for the new query, and then click Connect. You can click Cancel on the connection dialog if you do not want to associate a connection to the new query.

  6. Rename the query in Solution Explorer if you wish.

To add a new connection to an existing project

  1. In Solution Explorer, select a target project.

  2. On the Project menu, click Add New Item.

  3. Select Connection in the left pane.

  4. Select New Connection in the right pane, and then click Add.

  5. In the Connect to Database Engine dialog box, specify a connection for the new query, and then click Connect. The new connection gets added in the Connections folder of the project.

See Also

Solution Explorer
Associating File Extensions to a Code Editor
Add Existing Items to a Project
Remove or Delete an Item or Project