Skip to content

Commit a1b4e4f

Browse files
committed
Refresh connect-query-vscode
1 parent 1997e2e commit a1b4e4f

3 files changed

Lines changed: 62 additions & 58 deletions

File tree

‎azure-sql/database/connect-query-vscode.md‎

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ titleSuffix: Azure SQL Database & SQL Managed Instance
44
description: Learn how to connect to Azure SQL Database or SQL Managed Instance on Azure by using Visual Studio Code. Then, run Transact-SQL (T-SQL) statements to query and edit data.
55
author: dzsquared
66
ms.author: drskwier
7-
ms.reviewer: wiassaf, mathoma
8-
ms.date: 05/29/2020
7+
ms.reviewer: wiassaf, mathoma, randolphwest
8+
ms.date: 08/29/2023
99
ms.service: sql-database
1010
ms.subservice: connect
1111
ms.topic: quickstart
1212
ms.custom:
1313
- sqldbrb=2
1414
- mode-ui
1515
keywords: connect to sql database
16-
monikerRange: "= azuresql || = azuresql-db || = azuresql-mi"
16+
monikerRange: "=azuresql || =azuresql-db || =azuresql-mi"
1717
---
18-
# Quickstart: Use Visual Studio Code to connect and query
19-
[!INCLUDE[appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
18+
# Quickstart: Use Visual Studio Code to connect and query
19+
20+
[!INCLUDE [appliesto-sqldb-sqlmi](../includes/appliesto-sqldb-sqlmi.md)]
2021

2122
[Visual Studio Code](https://code.visualstudio.com/docs) is a graphical code editor for Linux, macOS, and Windows. It supports extensions, including the [mssql extension](https://aka.ms/mssql-marketplace) for querying a SQL Server instance, Azure SQL Database, an Azure SQL Managed Instance, and a database in Azure Synapse Analytics. In this quickstart, you'll use Visual Studio Code to connect to Azure SQL Database or Azure SQL Managed Instance and then run Transact-SQL statements to query, insert, update, and delete data.
2223

@@ -25,16 +26,16 @@ monikerRange: "= azuresql || = azuresql-db || = azuresql-mi"
2526
- A database in Azure SQL Database or Azure SQL Managed Instance. You can use one of these quickstarts to create and then configure a database in Azure SQL Database:
2627

2728
| Action | Azure SQL Database | Azure SQL Managed Instance |
28-
|:--- |:--- |:---|
29-
| Create| [Portal](single-database-create-quickstart.md) | [Portal](../managed-instance/instance-create-quickstart.md) |
30-
|| [CLI](scripts/create-and-configure-database-cli.md) | [CLI](https://medium.com/azure-sqldb-managed-instance/working-with-sql-managed-instance-using-azure-cli-611795fe0b44) |
31-
|| [PowerShell](scripts/create-and-configure-database-powershell.md) | [PowerShell](../managed-instance/scripts/create-configure-managed-instance-powershell.md) |
32-
| Configure | [Server-level IP firewall rule](firewall-create-server-level-portal-quickstart.md))| [Connectivity from a virtual machine (VM)](../managed-instance/connect-vm-instance-configure.md)|
29+
| :--- | :--- | :--- |
30+
| Create | [Portal](single-database-create-quickstart.md) | [Portal](../managed-instance/instance-create-quickstart.md) |
31+
| | [CLI](scripts/create-and-configure-database-cli.md) | [CLI](https://medium.com/azure-sqldb-managed-instance/working-with-sql-managed-instance-using-azure-cli-611795fe0b44) |
32+
| | [PowerShell](scripts/create-and-configure-database-powershell.md) | [PowerShell](../managed-instance/scripts/create-configure-managed-instance-powershell.md) |
33+
| Configure | [Server-level IP firewall rule](firewall-create-server-level-portal-quickstart.md)) | [Connectivity from a virtual machine (VM)](../managed-instance/connect-vm-instance-configure.md) |
3334
|||[Connectivity from on-premises](../managed-instance/point-to-site-p2s-configure.md)
3435
|Load data|Wide World Importers loaded per quickstart|[Restore Wide World Importers](../managed-instance/restore-sample-database-quickstart.md)
35-
|||Restore or import Adventure Works from a [BACPAC](database-import.md) file from [GitHub](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works)|
36+
| | | Restore or import Adventure Works from a [BACPAC](database-import.md) file from [GitHub](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works) |
3637

37-
> [!IMPORTANT]
38+
> [!IMPORTANT]
3839
> The scripts in this article are written to use the Adventure Works database. With a SQL Managed Instance, you must either import the Adventure Works database into an instance database or modify the scripts in this article to use the Wide World Importers database.
3940
4041
## Install Visual Studio Code
@@ -44,7 +45,7 @@ Make sure you have installed the latest [Visual Studio Code](https://code.visual
4445

4546
## Configure Visual Studio Code
4647

47-
### **macOS**
48+
### macOS
4849

4950
For macOS, you need to install OpenSSL, which is a prerequisite for .NET Core that mssql extension uses. Open your terminal and enter the following commands to install **brew** and **OpenSSL**.
5051

@@ -57,11 +58,11 @@ ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
5758
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
5859
```
5960

60-
### **Linux (Ubuntu)**
61+
### Linux (Ubuntu)
6162

6263
No special configuration needed.
6364

64-
### **Windows**
65+
### Windows
6566

6667
No special configuration needed.
6768

@@ -71,45 +72,45 @@ Get the connection information you need to connect to Azure SQL Database. You'll
7172

7273
1. Sign in to the [Azure portal](https://portal.azure.com/).
7374

74-
2. Navigate to the **SQL databases** or **SQL Managed Instances** page.
75+
1. Navigate to the **SQL databases** or **SQL Managed Instances** page.
7576

76-
3. On the **Overview** page, review the fully qualified server name next to **Server name** for SQL Database or the fully qualified server name next to **Host** for a SQL Managed Instance. To copy the server name or host name, hover over it and select the **Copy** icon.
77+
1. On the **Overview** page, review the fully qualified server name next to **Server name** for SQL Database or the fully qualified server name next to **Host** for a SQL Managed Instance. To copy the server name or host name, hover over it and select the **Copy** icon.
7778

7879
## Set language mode to SQL
7980

8081
In Visual Studio Code, set the language mode to **SQL** to enable mssql commands and T-SQL IntelliSense.
8182

8283
1. Open a new Visual Studio Code window.
8384

84-
2. Press **Ctrl**+**N**. A new plain text file opens.
85+
1. Press **Ctrl**+**N**. A new plain text file opens.
8586

86-
3. Select **Plain Text** in the status bar's lower right-hand corner.
87+
1. Select **Plain Text** in the status bar's lower right-hand corner.
8788

88-
4. In the **Select language mode** drop-down menu that opens, select **SQL**.
89+
1. In the **Select language mode** dropdown list that opens, select **SQL**.
8990

9091
## Connect to your database
9192

9293
Use Visual Studio Code to establish a connection to your server.
9394

94-
> [!IMPORTANT]
95-
> Before continuing, make sure that you have your server and sign in information ready. Once you begin entering the connection profile information, if you change your focus from Visual Studio Code, you have to restart creating the profile.
95+
> [!IMPORTANT]
96+
> Before continuing, make sure that you have your server and sign-in information ready. Once you begin entering the connection profile information, if you change your focus from Visual Studio Code, you have to restart creating the profile.
9697
9798
1. In Visual Studio Code, press **Ctrl+Shift+P** (or **F1**) to open the Command Palette.
9899

99-
2. Select **MS SQL:Connect** and choose **Enter**.
100+
1. Select **MS SQL:Connect** and choose **Enter**.
100101

101-
3. Select **Create Connection Profile**.
102+
1. Select **Create Connection Profile**.
102103

103-
4. Follow the prompts to specify the new profile's connection properties. After specifying each value, choose **Enter** to continue.
104+
1. Follow the prompts to specify the new profile's connection properties. After specifying each value, choose **Enter** to continue.
104105

105-
| Property       | Suggested value | Description |
106-
| ------------ | ------------------ | ------------------------------------------------- |
106+
| Property       | Suggested value | Description  |
107+
| --- | --- | --- |
107108
| **Server name** | The fully qualified server name | Something like: **mynewserver20170313.database.windows.net**. |
108109
| **Database name** | mySampleDatabase | The database to connect to. |
109-
| **Authentication** | SQL Login| This tutorial uses SQL Authentication. |
110+
| **Authentication** | SQL Login | This tutorial uses SQL Authentication. |
110111
| **User name** | User name | The user name of the server admin account used to create the server. |
111112
| **Password (SQL Login)** | Password | The password of the server admin account used to create the server. |
112-
| **Save Password?** | Yes or No | Select **Yes** if you do not want to enter the password each time. |
113+
| **Save Password?** | Yes or No | Select **Yes** if you don't want to enter the password each time. |
113114
| **Enter a name for this profile** | A profile name, such as **mySampleProfile** | A saved profile speeds your connection on subsequent logins. |
114115

115116
If successful, a notification appears saying your profile is created and connected.
@@ -121,15 +122,16 @@ Run the following [SELECT](/sql/t-sql/queries/select-transact-sql) Transact-SQL
121122
1. In the editor window, paste the following SQL query.
122123

123124
```sql
124-
SELECT pc.Name as CategoryName, p.name as ProductName
125+
SELECT pc.Name AS CategoryName,
126+
p.name AS ProductName
125127
FROM [SalesLT].[ProductCategory] pc
126-
JOIN [SalesLT].[Product] p
127-
ON pc.productcategoryid = p.productcategoryid;
128+
INNER JOIN [SalesLT].[Product] p
129+
ON pc.ProductCategoryId = p.ProductCategoryId;
128130
```
129131

130-
2. Press **Ctrl**+**Shift**+**E** to run the query and display results from the `Product` and `ProductCategory` tables.
132+
1. Press **Ctrl**+**Shift**+**E** to run the query and display results from the `Product` and `ProductCategory` tables.
131133

132-
![Query to retrieve data from 2 tables](./media/connect-query-vscode/query.png)
134+
:::image type="content" source="./media/connect-query-vscode/query.png" alt-text="Screenshot of query to retrieve data from 2 tables.":::
133135

134136
## Insert data
135137

@@ -138,25 +140,27 @@ Run the following [INSERT](/sql/t-sql/statements/insert-transact-sql) Transact-S
138140
1. Replace the previous query with this one.
139141

140142
```sql
141-
INSERT INTO [SalesLT].[Product]
142-
([Name]
143-
,[ProductNumber]
144-
,[Color]
145-
,[ProductCategoryID]
146-
,[StandardCost]
147-
,[ListPrice]
148-
,[SellStartDate])
149-
VALUES
150-
('myNewProduct'
151-
,123456789
152-
,'NewColor'
153-
,1
154-
,100
155-
,100
156-
,GETDATE());
143+
INSERT INTO [SalesLT].[Product] (
144+
[Name],
145+
[ProductNumber],
146+
[Color],
147+
[ProductCategoryID],
148+
[StandardCost],
149+
[ListPrice],
150+
[SellStartDate]
151+
)
152+
VALUES (
153+
'myNewProduct',
154+
123456789,
155+
'NewColor',
156+
1,
157+
100,
158+
100,
159+
GETDATE()
160+
);
157161
```
158162

159-
2. Press **Ctrl**+**Shift**+**E** to insert a new row in the `Product` table.
163+
1. Press **Ctrl**+**Shift**+**E** to insert a new row in the `Product` table.
160164

161165
## Update data
162166

@@ -170,7 +174,7 @@ Run the following [UPDATE](/sql/t-sql/queries/update-transact-sql) Transact-SQL
170174
WHERE Name = 'myNewProduct';
171175
```
172176

173-
2. Press **Ctrl**+**Shift**+**E** to update the specified row in the `Product` table.
177+
1. Press **Ctrl**+**Shift**+**E** to update the specified row in the `Product` table.
174178

175179
## Delete data
176180

@@ -183,10 +187,10 @@ Run the following [DELETE](/sql/t-sql/statements/delete-transact-sql) Transact-S
183187
WHERE Name = 'myNewProduct';
184188
```
185189

186-
2. Press **Ctrl**+**Shift**+**E** to delete the specified row in the `Product` table.
190+
1. Press **Ctrl**+**Shift**+**E** to delete the specified row in the `Product` table.
187191

188192
## Next steps
189193

190-
- To connect and query using SQL Server Management Studio, see [Quickstart: Use SQL Server Management Studio to connect to a database in Azure SQL Database and query data](connect-query-ssms.md).
191-
- To connect and query using the Azure portal, see [Use the SQL Query editor in the Azure portal to connect and query data](query-editor.md).
192-
- For an MSDN magazine article on using Visual Studio Code, see [Create a database IDE with MSSQL extension blog post](/archive/msdn-magazine/2017/june/data-points-visual-studio-code-create-a-database-ide-with-mssql-extension).
194+
- [Quickstart: Use SQL Server Management Studio to connect to a database in Azure SQL Database and query data](connect-query-ssms.md)
195+
- [Use the SQL Query editor in the Azure portal to connect and query data](query-editor.md)
196+
- [Create a database IDE with MSSQL extension blog post](/archive/msdn-magazine/2017/june/data-points-visual-studio-code-create-a-database-ide-with-mssql-extension)

‎docs/database-engine/configure-windows/manage-certificates.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ With [!INCLUDE [sssql19-md](../../includes/sssql19-md.md)] and later versions, c
5555

5656
1. Right-click **Protocols for** *<instance Name>*, and then select **Properties**.
5757

58-
1. Select a certificate from the **Certificate** dropdown list menu, and then select **Apply**.
58+
1. Select a certificate from the **Certificate** dropdown list, and then select **Apply**.
5959

6060
1. Select **OK**.
6161
::: moniker-end

‎docs/ssma/access/exporting-an-access-inventory-accesstosql.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ For more information about adding databases to projects, see [Adding and Removin
104104

105105
1. If your instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] is configured to accept connections on a non-default port, enter the port number that is used for [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] connections in the **Server port** box. For the default instance of [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)], the default port number is 1433. For named instances, SSMA tries to obtain the port number from the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] Browser Service.
106106

107-
1. In the **Authentication** dropdown list menu, select the authentication type to use for the connection. To use the current Windows account, select **Windows Authentication**. To use a [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] login, select **SQL Server Authentication**, and then provide a user name and password.
107+
1. In the **Authentication** dropdown list, select the authentication type to use for the connection. To use the current Windows account, select **Windows Authentication**. To use a [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] login, select **SQL Server Authentication**, and then provide a user name and password.
108108

109109
For more information about connecting to [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)], see [Connecting to SQL Server (AccessToSQL)](../../ssma/access/connecting-to-sql-server-accesstosql.md).
110110

0 commit comments

Comments
 (0)