| title | Develop and Deploy SQL Server databases for Linux | Microsoft Docs |
|---|---|
| description | |
| author | erickangMSFT |
| ms.author | erickang |
| manager | jroth |
| ms.date | 03/17/2017 |
| ms.topic | article |
| ms.prod | sql-non-specified |
| ms.prod_service | database-engine |
| ms.service | |
| ms.component | |
| ms.suite | sql |
| ms.technology | database-engine |
| ms.assetid | 1e924704-e07c-4a8b-b243-8c1dd8cff0d3 |
| ms.custom | sql-linux |
| ms.workload | On Demand |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md-linuxonly]
SQL Server Data Tools (SSDT) turns Visual Studio into a powerful development and database lifecycle management (DLM) environment for SQL Server on Linux. You can develop, build, test, and publish your database from a source-controlled project, just like you develop your application code.
-
If you have not already installed Visual Studio on your Windows machine, Download and Install Visual Studio. If you do not have a Visual Studio license, Visual Studio Community edition is a free, fully-featured IDE for students, open-source and individual developers.
-
During the Visual Studio installation, select Custom for the Choose the type of installation option. Click Next
-
Select Microsoft SQL Server Data Tools, Git for Windows, and GitHub Extension for Visual Studio from the feature selection list.
-
Continue and finish the installation of Visual Studio. It can take a few minutes.
SQL Server 2017 on Linux is supported by SSDT version 17.0 RC or later.
-
Launch Visual Studio.
-
Select Team Explorer on the View menu.
-
Click New in Local Git Repository section on the Connect page.
-
Click Create. After the local Git repository is created, double click SSDTRepo.
-
Click New in the Solutions section. Select SQL Server under Other Languages node in the New Project dialog.
-
Type in TutorialDB for the name and click OK to create a new database project.
-
Select Solution Explorer on the View menu.
-
Open the database project menu by right-clicking on TutorialDB in Solution Explorer.
-
Select Table under Add.
-
Using table designer, add two columns, Name
nvarchar(50)and Locationnvarchar(50), as shown in the picture. SSDT generates theCREATE TABLEscript as you add the columns in the designer.
-
Save the Table1.sql file.
-
Open the database project menu on TutorialDB and select Build. SSDT compiles .sql source code files in your project and builds a Data-tier Application package (dacpac) file. This can be used to publish a database to your SQL Server 2017 instance on Linux.
-
Check the build success message in Output window in Visual Studio.
-
Open the database project menu on TutorialDB and select Publish.
-
Click Edit to select your SQL Server instance on Linux.
-
On the connection dialog, type in the IP address or host name of your SQL Server instance on Linux, user name and password.
-
Click the Publish button on the publish dialog.
-
Check the publish status in the Data Tools Operations window.
-
Click View Reulst or View Script to see details of the database publish result on your SQL Server on Linux.
You have successfully created a new database on SQL Server instance on Linux and learned the basics of developing a database with a source-controlled database project.
If you're new to T-SQL, see Tutorial: Writing Transact-SQL Statements and the Transact-SQL Reference (Database Engine).
For more information about developing a database with SQL Data Tools, see SSDT MSDN documents