

Select the specific project (in this case – SQLShack) and Open it. It takes you the default directory for the projects. To open existing projects, click on File – Open -> Project/Solution. You can store many files in the solution. Similarly, create another SQL file and save it, as shown below. It is advantageous if you have a large number of query files. You should give it a familiar name so that you can easily identify queries from the file name. Right-click on the query file and rename it. Once you save the query, it shows a green color in front of the query text. Right-click on the query title and save it.

Click on Execute or press F5 to execute the query. Let’s specify a system stored procedure SP_HELPDB in the new query window. You can either click on a connection to open a new query window. In the query tab, we can create multiple SQL query files. It shows the instance in the connection window. Specify SQL Instance, Authentication (Windows or SQL ), and connect to the instance. It opens the SSMS SQL Server connection window. Right-click on Connections and New Connection. Suppose you have a Dev, Test, and Production environment, and we can run queries on any environment based on our requirement. In the connection tab, we can create multiple SQL Server connections for different environments, servers. Here, we see each project contains different objects: Connections, Queries, and Miscellaneous. Here, Select Add to Solution to add the project into exiting solution.Ĭlick OK, and it adds a new project into the existing project, as shown below. Let’s create a new project in the same solution. We can create multiple projects in a solution. By default, SQL Server creates a solution for every project with a similar name.

The solution is a logical grouping of project-related resources. You can also use keyboard shortcut Ctrl+Alt+L. If this solution explorer is not visible, go to View-> Solution Explorer. Let’s select SQL Server Scripts for this articleĬlick OK, and it opens the Solution Explorer to manage the project and its resources. Here, we do the following configurations.Ĭhoose either SQL Server Scripts or Analysis Services Script. It opens a new project configuration window. We can organize T-SQL codes using SSMS projects. I am using the latest general availability release SSMS 18.4. In this article, we look at how Solutions and Projects help to organize T-SQL scripts. You might use Visual Studio, GitHub source control for it. It is a good practice to organize code or t-SQL scripts so that we can easily access them without wasting time searching for them. DBAs and developers manage a broad set of queries, codes, applications.
