|
1 | 1 | --- |
2 | 2 | title: Get Started with SQL Database Projects |
3 | 3 | description: A SQL database project is a local representation of SQL objects that comprise the schema for a single database, such as tables, stored procedures, or functions. |
4 | | -author: dzsquared |
5 | | -ms.author: drskwier |
6 | | -ms.reviewer: maghan, randolphwest |
7 | | -ms.date: 01/29/2026 |
| 4 | +author: rwestMSFT |
| 5 | +ms.author: randolphwest |
| 6 | +ms.reviewer: drskwier |
| 7 | +ms.date: 03/11/2026 |
8 | 8 | ms.service: sql |
9 | 9 | ms.subservice: sql-database-projects |
10 | 10 | ms.topic: get-started |
@@ -33,31 +33,39 @@ This article steps through creating a new SQL project, adding objects to the pro |
33 | 33 |
|
34 | 34 | ::: zone pivot="sq1-visual-studio" |
35 | 35 |
|
36 | | -- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) |
| 36 | +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
37 | 37 | - [Visual Studio 2022 Community, Professional, or Enterprise](https://visualstudio.microsoft.com/downloads/) |
38 | 38 | - [Install SQL Server Data Tools (SSDT) for Visual Studio](../../ssdt/download-sql-server-data-tools-ssdt.md) |
39 | 39 |
|
40 | 40 | ::: zone-end |
41 | 41 |
|
42 | 42 | ::: zone pivot="sq1-visual-studio-sdk" |
43 | 43 |
|
44 | | -- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) |
| 44 | +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
45 | 45 | - [Visual Studio 2022 Community, Professional, or Enterprise](https://visualstudio.microsoft.com/downloads/) |
46 | | -- [SQL Server Data Tools, SDK-style (preview) installed in Visual Studio](../../ssdt/sql-server-data-tools-sdk-style.md) |
| 46 | +- [SQL Server Data Tools, SDK-style (preview)](../../ssdt/sql-server-data-tools-sdk-style.md) |
47 | 47 |
|
48 | 48 | ::: zone-end |
49 | 49 |
|
50 | 50 | ::: zone pivot="sq1-visual-studio-code" |
51 | 51 |
|
52 | | -- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) |
| 52 | +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
53 | 53 | - [VS Code](https://code.visualstudio.com/Download) |
54 | 54 | - [SQL Database Projects extension](../visual-studio-code-extensions/sql-database-projects/sql-database-projects-extension.md) |
55 | 55 |
|
56 | 56 | ::: zone-end |
57 | 57 |
|
| 58 | +:::zone pivot="sq1-sql-server-management-studio" |
| 59 | + |
| 60 | +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
| 61 | +- [SQL Server Management Studio (SSMS)](/ssms/install/install) |
| 62 | +- [Database DevOps workload installed in SSMS](/ssms/database-devops) |
| 63 | + |
| 64 | +:::zone-end |
| 65 | + |
58 | 66 | ::: zone pivot="sq1-command-line" |
59 | 67 |
|
60 | | -- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) |
| 68 | +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
61 | 69 | - [SqlPackage CLI](../sqlpackage/sqlpackage-download.md) |
62 | 70 | - [Microsoft.Build.Sql.Templates .NET templates](https://www.nuget.org/packages/Microsoft.Build.Sql.Templates/) |
63 | 71 |
|
@@ -124,6 +132,20 @@ Once completed, the empty project is opened and visible in the **Database Projec |
124 | 132 |
|
125 | 133 | ::: zone-end |
126 | 134 |
|
| 135 | +:::zone pivot="sq1-sql-server-management-studio" |
| 136 | + |
| 137 | +Select **File**, **New**, then **Project**. |
| 138 | + |
| 139 | +In the **New Project** dialog box, use the term **SQL Server** in the search box. The top result should be **SQL Server Database Project**. |
| 140 | + |
| 141 | +:::image type="content" source="media/getting-started/new-project-dialog-ssms.png" alt-text="Screenshot of New project dialog." lightbox="media/getting-started/new-project-dialog-ssms.png"::: |
| 142 | + |
| 143 | +Select **Next** to proceed to the next step. Provide a project name, which doesn't need to match a database name. Verify and modify the project location as needed. |
| 144 | + |
| 145 | +Select **Create** to create the project. The empty project is opened and visible in the **Solution Explorer** for editing. |
| 146 | + |
| 147 | +:::zone-end |
| 148 | + |
127 | 149 | ::: zone pivot="sq1-command-line" |
128 | 150 |
|
129 | 151 | With the .NET templates for Microsoft.Build.Sql projects installed, you can create a new SQL database project from the command line. The `-n` option specifies the name of the project, and the `-tp` option specifies the project target platform. |
@@ -169,6 +191,16 @@ More database objects can be added through the context menu on the project node, |
169 | 191 |
|
170 | 192 | ::: zone-end |
171 | 193 |
|
| 194 | +::: zone pivot="sq1-sql-server-management-studio" |
| 195 | + |
| 196 | +In **Solution Explorer**, right-click the project node and select **Add**, then **New Item**. The **Add New Item** dialog appears, select **Show All Templates** and then **Table**. Specify the table name as the file name and select **Add** to create the table in the SQL project. |
| 197 | + |
| 198 | +The table is opened in the SSMS query editor with the template table definition, where you can add columns, indexes, and other table properties. Save the file when you're done making the initial edits. |
| 199 | + |
| 200 | +More database objects can be added through the **Add New Item** dialog, such as views, stored procedures, and functions. Access the dialog by right-clicking the project node in **Solution Explorer** and selecting **Add**, then the desired object type after **Show All Templates**. Files in the project can be organized into folders through the **New Folder** option under **Add**. |
| 201 | + |
| 202 | +::: zone-end |
| 203 | + |
172 | 204 | ::: zone pivot="sq1-command-line" |
173 | 205 |
|
174 | 206 | Files can be added to the project by creating them in the project directory or nested folders. The file extension should be `.sql` and organization by object type or schema and object type is recommended. |
@@ -212,6 +244,14 @@ The output window automatically opens to display the build process. If there are |
212 | 244 |
|
213 | 245 | ::: zone-end |
214 | 246 |
|
| 247 | +::: zone pivot="sq1-sql-server-management-studio" |
| 248 | + |
| 249 | +In **Solution Explorer**, right-click the project node and select **Build**. |
| 250 | + |
| 251 | +The output window automatically opens to display the build process. If there are errors or warnings, they're displayed in the output window. On a successful build, the build artifact (`.dacpac` file) is created its location is included in the build output (default is `bin\Debug\projectname.dacpac`). |
| 252 | + |
| 253 | +::: zone-end |
| 254 | + |
215 | 255 | ::: zone pivot="sq1-command-line" |
216 | 256 |
|
217 | 257 | SQL database projects can be built from the command line using the `dotnet build` command. |
@@ -266,6 +306,16 @@ After the connection is configured, the deployment process will begin. You can c |
266 | 306 |
|
267 | 307 | ::: zone-end |
268 | 308 |
|
| 309 | +::: zone pivot="sq1-sql-server-management-studio" |
| 310 | + |
| 311 | +In **Solution Explorer**, right-click the project node and select **Publish...**. |
| 312 | + |
| 313 | +The publish dialog opens, where you establish the **target database connection**. If you don't have an existing SQL instance for deployment, LocalDB (`(localdb)\MSSQLLocalDB`) is installed with Visual Studio and can be used for testing and development. |
| 314 | + |
| 315 | +Specify a database name and select **Publish** to deploy the project to the target database or **Generate Script** to generate a script to review before executing. |
| 316 | + |
| 317 | +::: zone-end |
| 318 | + |
269 | 319 | ::: zone pivot="sq1-command-line" |
270 | 320 |
|
271 | 321 | The SqlPackage CLI is used to deploy a `.dacpac` file to a target database with the [publish action](../sqlpackage/sqlpackage-publish.md). |
|
0 commit comments